diff options
author | Yang Tse <yangsita@gmail.com> | 2009-12-03 20:37:49 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2009-12-03 20:37:49 +0000 |
commit | d14bf09ab8ca502a7d3b5d863d84efc1dfa0ad58 (patch) | |
tree | ec08d7bafe0b6b109477fbee98d0023182495d0d /tests/server | |
parent | 636d2fe00a4c09f3d9a857bee2c08117e325ea72 (diff) |
Fix 'uploaded' file descriptor leak
Diffstat (limited to 'tests/server')
-rw-r--r-- | tests/server/tftpd.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/server/tftpd.c b/tests/server/tftpd.c index 9106836f2..c569085dc 100644 --- a/tests/server/tftpd.c +++ b/tests/server/tftpd.c @@ -664,6 +664,8 @@ int main(int argc, char **argv) struct testcase test; int result = 0; + memset(&test, 0, sizeof(test)); + while(argc>arg) { if(!strcmp("--version", argv[arg])) { printf("tftpd IPv4%s\n", @@ -810,6 +812,11 @@ int main(int argc, char **argv) sclose(peer); peer = CURL_SOCKET_BAD; + if(test.ofile > 0) { + close(test.ofile); + test.ofile = 0; + } + if(got_exit_signal) break; @@ -824,6 +831,9 @@ int main(int argc, char **argv) tftpd_cleanup: + if(test.ofile > 0) + close(test.ofile); + if((peer != sock) && (peer != CURL_SOCKET_BAD)) sclose(peer); |