commit | 4aef93acff8932e9fc9a84bc1ccce8903806b193 | [log] [tgz] |
---|---|---|
author | Elliott Hughes <enh@google.com> | Tue Nov 05 12:42:14 2019 -0800 |
committer | Elliott Hughes <enh@google.com> | Tue Nov 05 12:42:14 2019 -0800 |
tree | 2650d2106682389f1b5df22a0b6d0f18f80a37e8 | |
parent | 590bdbe6e938e1bc53b09674b7eedde440863f11 [diff] |
android_getaddrinfo_proxy: fix memory leak on failure. The shadowing of `ai` meant that the freeaddrinfo() call outside the loop would never see anything but NULL. Bug: https://issuetracker.google.com/143928781 Test: treehugger Change-Id: I1bf137f7933201eb8024603bfd569ff7bbc7f9b7
diff --git a/libc/dns/net/getaddrinfo.c b/libc/dns/net/getaddrinfo.c index 4e1aa61..d0c11d2 100644 --- a/libc/dns/net/getaddrinfo.c +++ b/libc/dns/net/getaddrinfo.c
@@ -470,7 +470,7 @@ break; } - struct addrinfo* ai = calloc(1, sizeof(struct addrinfo) + sizeof(struct sockaddr_storage)); + ai = calloc(1, sizeof(struct addrinfo) + sizeof(struct sockaddr_storage)); if (ai == NULL) { break; }