diff options
author | wens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-04-09 17:08:30 +0800 |
---|---|---|
committer | wens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-04-09 17:08:30 +0800 |
commit | c10b8ef1c562f3fc0797b15c550dce34e07fb231 (patch) | |
tree | fb8d4d247ff1db924f46ffde25a4308a7ac06fe8 /daemon | |
parent | 899bf216324943696435849414744499dd8a3303 (diff) | |
download | pttbbs-c10b8ef1c562f3fc0797b15c550dce34e07fb231.tar pttbbs-c10b8ef1c562f3fc0797b15c550dce34e07fb231.tar.gz pttbbs-c10b8ef1c562f3fc0797b15c550dce34e07fb231.tar.bz2 pttbbs-c10b8ef1c562f3fc0797b15c550dce34e07fb231.tar.lz pttbbs-c10b8ef1c562f3fc0797b15c550dce34e07fb231.tar.xz pttbbs-c10b8ef1c562f3fc0797b15c550dce34e07fb231.tar.zst pttbbs-c10b8ef1c562f3fc0797b15c550dce34e07fb231.zip |
Avoid memory and fd leak.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4112 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/fromd/fromd.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/daemon/fromd/fromd.c b/daemon/fromd/fromd.c index 04f357e6..5e080f7c 100644 --- a/daemon/fromd/fromd.c +++ b/daemon/fromd/fromd.c @@ -26,16 +26,17 @@ static void client_cb(int fd, short event, void *arg) // ignore clients that timeout if (event & EV_TIMEOUT) - return; + goto end; if ( (len = read(fd, buf, sizeof(buf) - 1)) <= 0 ) - return; + goto end; buf[len] = '\0'; result = ip_desc_db_lookup(buf); write(fd, result, strlen(result)); +end: // cleanup close(fd); free(arg); |