Commit cdb5a8ba75dd6051eb9c0ff9d63c59ecb704f5bd
1 parent
01d88fa4
Exists in
master
and in
5 other branches
Corrigindo memory leak
Showing
3 changed files
with
7 additions
and
4 deletions
Show diff stats
src/lib3270/Makefile.in
| @@ -127,7 +127,7 @@ $(BINRLS)/@DLLPREFIX@3270@DLLEXT@: $(foreach SRC, $(basename $(SOURCES)), $(OBJR | @@ -127,7 +127,7 @@ $(BINRLS)/@DLLPREFIX@3270@DLLEXT@: $(foreach SRC, $(basename $(SOURCES)), $(OBJR | ||
| 127 | $(BINDBG)/testprogram$(EXEEXT): $(OBJDBG)/testprogram.o $(foreach SRC, $(basename $(SOURCES)), $(OBJDBG)/$(SRC)@OBJEXT@) | 127 | $(BINDBG)/testprogram$(EXEEXT): $(OBJDBG)/testprogram.o $(foreach SRC, $(basename $(SOURCES)), $(OBJDBG)/$(SRC)@OBJEXT@) |
| 128 | @echo " CCLD `basename $@`" | 128 | @echo " CCLD `basename $@`" |
| 129 | @$(MKDIR) `dirname $@` | 129 | @$(MKDIR) `dirname $@` |
| 130 | - $(LD) -o $@ $^ $(LIBS) | 130 | + $(LD) -pthread -o $@ $^ $(LIBS) |
| 131 | 131 | ||
| 132 | $(DEBDIR)/lib3270.install: Makefile | 132 | $(DEBDIR)/lib3270.install: Makefile |
| 133 | @echo " GEN `basename $@`" | 133 | @echo " GEN `basename $@`" |
src/lib3270/host.c
| @@ -474,9 +474,9 @@ split_success: | @@ -474,9 +474,9 @@ split_success: | ||
| 474 | 474 | ||
| 475 | static int do_connect(H3270 *hSession, const char *n) | 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 | // char *ps = CN; | 480 | // char *ps = CN; |
| 481 | char *port = CN; | 481 | char *port = CN; |
| 482 | Boolean resolving; | 482 | Boolean resolving; |
| @@ -555,6 +555,8 @@ static int do_connect(H3270 *hSession, const char *n) | @@ -555,6 +555,8 @@ static int do_connect(H3270 *hSession, const char *n) | ||
| 555 | return -1; | 555 | return -1; |
| 556 | } | 556 | } |
| 557 | 557 | ||
| 558 | + chost = lib3270_free(chost); | ||
| 559 | + | ||
| 558 | /* Still thinking about it? */ | 560 | /* Still thinking about it? */ |
| 559 | if (resolving) | 561 | if (resolving) |
| 560 | { | 562 | { |
src/lib3270/testprogram.c
| @@ -33,6 +33,7 @@ int main(int numpar, char *param[]) | @@ -33,6 +33,7 @@ int main(int numpar, char *param[]) | ||
| 33 | printf("3270 session %p created\n]",h); | 33 | printf("3270 session %p created\n]",h); |
| 34 | 34 | ||
| 35 | pthread_create(&thread, NULL, mainloop, NULL); | 35 | pthread_create(&thread, NULL, mainloop, NULL); |
| 36 | + pthread_detach(thread); | ||
| 36 | 37 | ||
| 37 | while(fgets(line,4095,stdin)) | 38 | while(fgets(line,4095,stdin)) |
| 38 | { | 39 | { |