From 33249192591fb6dbe0bd301b44f09ac4de236713 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 5 Nov 2019 12:42:14 -0800 Subject: 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 --- libc/dns/net/getaddrinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/dns/net/getaddrinfo.c b/libc/dns/net/getaddrinfo.c index 201b4f4b2..cc94b21e2 100644 --- a/libc/dns/net/getaddrinfo.c +++ b/libc/dns/net/getaddrinfo.c @@ -472,7 +472,7 @@ android_getaddrinfo_proxy( 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; } -- cgit v1.2.3