diff options
| author | Yaroslav Tykhiy <ytykhiy@gmail.com> | 2002-08-31 13:12:29 +0000 |
|---|---|---|
| committer | Yaroslav Tykhiy <ytykhiy@gmail.com> | 2002-08-31 13:12:29 +0000 |
| commit | d09e917d3ded69109a8e8136c9d693003f40c586 (patch) | |
| tree | 49e5a07403ef953f951f65290c79ce00c7b365a2 /libexec | |
| parent | 7255f7f01fe7422009dfd8d02db995c0cd1433c7 (diff) | |
Notes
Diffstat (limited to 'libexec')
| -rw-r--r-- | libexec/ftpd/ftpd.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index e4bdfabf7ba7..e2e49aae2f63 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -794,12 +794,12 @@ inithosts() if ((hrp = malloc(sizeof(struct ftphost))) == NULL) goto nextline; hrp->hostname = NULL; - hrp->hostinfo = NULL; insert = 1; - } else + } else { + if (hrp->hostinfo) + freeaddrinfo(hrp->hostinfo); insert = 0; /* host already in the chain */ - if (hrp->hostinfo) - freeaddrinfo(hrp->hostinfo); + } hrp->hostinfo = res; /* @@ -819,9 +819,11 @@ inithosts() break; default: /* should not reach here */ - if (hrp->hostinfo != NULL) - freeaddrinfo(hrp->hostinfo); - free(hrp); + freeaddrinfo(hrp->hostinfo); + if (insert) + free(hrp); /*not in chain, can free*/ + else + hrp->hostinfo = NULL; /*mark as blank*/ goto nextline; /* NOTREACHED */ } @@ -847,8 +849,13 @@ inithosts() hrp->hostname = NULL; } if (hrp->hostname == NULL && - (hrp->hostname = strdup(vhost)) == NULL) + (hrp->hostname = strdup(vhost)) == NULL) { + freeaddrinfo(hrp->hostinfo); + hrp->hostinfo = NULL; /* mark as blank */ + if (hp) + freehostent(hp); goto nextline; + } hrp->anonuser = anonuser; hrp->statfile = statfile; hrp->welcome = welcome; |
