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.
This commit is contained in:
Peter Wemm 2000-07-11 09:31:19 +00:00
parent 040cfe28d1
commit 4a1afa49fd

View File

@ -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);
}