summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Wilson <alex@cooperi.net>2014-09-29 14:10:03 +1000
committerRobert Mustacchi <rm@joyent.com>2014-09-29 19:05:23 +0000
commitf2cba95bd1755104589820f6e8a4964a22112a39 (patch)
treea8d0d1d5bfd53bae9a5c5bf5e542dd708873e4e5
parent42048b322f4f60e5e4c02ff75b827c3aace4b41e (diff)
downloadillumos-joyent-f2cba95bd1755104589820f6e8a4964a22112a39.tar.gz
joyent/smartos-live#354 getipnodebyname mistakingly double frees
Reviewed by: Robert Mustacchi <rm@joyent.com>
-rw-r--r--usr/src/lib/libnsl/nss/getipnodeby.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr/src/lib/libnsl/nss/getipnodeby.c b/usr/src/lib/libnsl/nss/getipnodeby.c
index 3f88993868..f84b641157 100644
--- a/usr/src/lib/libnsl/nss/getipnodeby.c
+++ b/usr/src/lib/libnsl/nss/getipnodeby.c
@@ -362,9 +362,11 @@ getipnodebyname(const char *name, int af, int flags, int *error_num)
* !IPNODE_WANTIPV6.
*/
if (hp != NULL && (ipnode_bits & IPNODE_UNMAP)) {
- struct hostent *input = hp;
- hp = __mappedtov4(input, error_num);
- free(input);
+ /*
+ * Just set hp to a new value, cleanup: will
+ * free the old one
+ */
+ hp = __mappedtov4(hp, error_num);
} else if (hp == NULL)
*error_num = NO_ADDRESS;
}