Skip to content

Commit

Permalink
rdisc: Fix memory leakage in initifs() in error path.
Browse files Browse the repository at this point in the history
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
  • Loading branch information
yoshfuji committed Jan 25, 2013
1 parent fe31d3e commit b39a4fe
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions rdisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1128,12 +1128,10 @@ initifs()
(void) close(sock);
return;
}
if (interfaces)
interfaces = (struct interface *)ALLIGN(realloc((char *)interfaces,
numifs * sizeof(struct interface)));
else
interfaces = (struct interface *)ALLIGN(malloc(numifs *
sizeof(struct interface)));
if (interfaces != NULL)
(void) free(interfaces);
interfaces = (struct interface *)ALLIGN(malloc(numifs *
sizeof(struct interface)));
if (interfaces == NULL) {
logerr("out of memory\n");
(void) close(sock);
Expand Down

0 comments on commit b39a4fe

Please sign in to comment.