Fix potential double-free of so->answer.

NB: dns_so_submit calls dns_so_reset twice (once at start, once at end
on error). As so_reset will free so->answer the first time through,
add validity check of so->answer for the second iteration.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2013-08-05 13:48:23 +01:00
parent b211a27d67
commit 0f925220e1
1 changed files with 1 additions and 1 deletions

View File

@ -5525,7 +5525,7 @@ void dns_so_close(struct dns_socket *so) {
void dns_so_reset(struct dns_socket *so) {
free(so->answer);
if (so->answer) free(so->answer);
memset(&so->state, '\0', sizeof *so - offsetof(struct dns_socket, state));
} /* dns_so_reset() */