Commit cdb5a8ba75dd6051eb9c0ff9d63c59ecb704f5bd

Authored by perry.werneck@gmail.com
1 parent 01d88fa4

Corrigindo memory leak

src/lib3270/Makefile.in
... ... @@ -127,7 +127,7 @@ $(BINRLS)/@DLLPREFIX@3270@DLLEXT@: $(foreach SRC, $(basename $(SOURCES)), $(OBJR
127 127 $(BINDBG)/testprogram$(EXEEXT): $(OBJDBG)/testprogram.o $(foreach SRC, $(basename $(SOURCES)), $(OBJDBG)/$(SRC)@OBJEXT@)
128 128 @echo " CCLD `basename $@`"
129 129 @$(MKDIR) `dirname $@`
130   - $(LD) -o $@ $^ $(LIBS)
  130 + $(LD) -pthread -o $@ $^ $(LIBS)
131 131  
132 132 $(DEBDIR)/lib3270.install: Makefile
133 133 @echo " GEN `basename $@`"
... ...
src/lib3270/host.c
... ... @@ -474,9 +474,9 @@ split_success:
474 474  
475 475 static int do_connect(H3270 *hSession, const char *n)
476 476 {
477   - char nb[2048]; /* name buffer */
478   - char *s; /* temporary */
479   - const char *chost; /* to whom we will connect */
  477 + char nb[2048]; /* name buffer */
  478 + char *s; /* temporary */
  479 + char *chost = NULL; /* to whom we will connect */
480 480 // char *ps = CN;
481 481 char *port = CN;
482 482 Boolean resolving;
... ... @@ -555,6 +555,8 @@ static int do_connect(H3270 *hSession, const char *n)
555 555 return -1;
556 556 }
557 557  
  558 + chost = lib3270_free(chost);
  559 +
558 560 /* Still thinking about it? */
559 561 if (resolving)
560 562 {
... ...
src/lib3270/testprogram.c
... ... @@ -33,6 +33,7 @@ int main(int numpar, char *param[])
33 33 printf("3270 session %p created\n]",h);
34 34  
35 35 pthread_create(&thread, NULL, mainloop, NULL);
  36 + pthread_detach(thread);
36 37  
37 38 while(fgets(line,4095,stdin))
38 39 {
... ...