commit | e6418c87528ad98cfadcb25dea59e71139ec3fc6 | [log] [tgz] |
---|---|---|
author | Elliott Hughes <enh@google.com> | Tue Nov 05 12:42:14 2019 -0800 |
committer | rohan <purohit.rohan@gmail.com> | Mon May 25 11:00:13 2020 -0400 |
tree | 7f6bc5df830545f380d2b87376b7205b04315cff | |
parent | d71b1d50e10c440ceeba36051c8a84fa582d8425 [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 201b4f4..cc94b21 100644 --- a/libc/dns/net/getaddrinfo.c +++ b/libc/dns/net/getaddrinfo.c
@@ -472,7 +472,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; }