summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2000-07-11 09:31:19 +0000
committerpeter <peter@FreeBSD.org>2000-07-11 09:31:19 +0000
commit63c050d16ca6926933b42c7b93d2b09b9045b7b9 (patch)
tree998f660cca0e89bf57093fbfb0ad34d617eefe17
parentc1aed73081c125d0ed5c79079f1778e02407e211 (diff)
downloadFreeBSD-src-63c050d16ca6926933b42c7b93d2b09b9045b7b9.zip
FreeBSD-src-63c050d16ca6926933b42c7b93d2b09b9045b7b9.tar.gz
Try and fix the worst of some highly bogus malloc/free resource
management involving rcmd_af(), getaddrinfo(), freeaddrinfo(), etc. We set *ahost to point to ai->canonname; and later free the ai-> stuff and still leave the old pointers in *ahost to the freed data. Perhaps the best way to deal with this is a static buffer or a static strdup() that is freed on the next iteration or something. This gives me headaches just thinking about this. The new 'AJ' default for malloc() tripped this up.
-rw-r--r--lib/libc/net/rcmd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/net/rcmd.c b/lib/libc/net/rcmd.c
index 5bbef4b..70a18d4 100644
--- a/lib/libc/net/rcmd.c
+++ b/lib/libc/net/rcmd.c
@@ -182,8 +182,8 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
refused = 0;
continue;
}
- freeaddrinfo(res);
(void)fprintf(stderr, "%s: %s\n", *ahost, strerror(errno));
+ freeaddrinfo(res);
sigsetmask(oldmask);
return (-1);
}
OpenPOWER on IntegriCloud