Skip to content

Commit f2cba95

Browse files
arekinathrmustacc
authored andcommitted
TritonDataCenter/smartos-live#354 getipnodebyname mistakingly double frees
Reviewed by: Robert Mustacchi <rm@joyent.com>
1 parent 42048b3 commit f2cba95

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

usr/src/lib/libnsl/nss/getipnodeby.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,11 @@ getipnodebyname(const char *name, int af, int flags, int *error_num)
362362
* !IPNODE_WANTIPV6.
363363
*/
364364
if (hp != NULL && (ipnode_bits & IPNODE_UNMAP)) {
365-
struct hostent *input = hp;
366-
hp = __mappedtov4(input, error_num);
367-
free(input);
365+
/*
366+
* Just set hp to a new value, cleanup: will
367+
* free the old one
368+
*/
369+
hp = __mappedtov4(hp, error_num);
368370
} else if (hp == NULL)
369371
*error_num = NO_ADDRESS;
370372
}

0 commit comments

Comments
 (0)