Permalink
Browse files

joyent/smartos-live#354 getipnodebyname mistakingly double frees

Reviewed by: Robert Mustacchi <rm@joyent.com>
  • Loading branch information...
arekinath authored and rmustacc committed Sep 29, 2014
1 parent 42048b3 commit f2cba95bd1755104589820f6e8a4964a22112a39
Showing with 5 additions and 3 deletions.
  1. +5 −3 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;
}

0 comments on commit f2cba95

Please sign in to comment.