aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2019-11-05 12:42:14 -0800
committerWang Han <416810799@qq.com>2020-04-23 18:44:21 +0800
commit40e6fdba0b80a99c240603eecfb5b1d7c2ee1ed2 (patch)
tree2af24a679591111c4d167d568ce0f0d77f1f3477
parentd1d03ac595f2a2a227572de0fa00f1a17e190f69 (diff)
downloadandroid_bionic-lineage-17.1.tar.gz
android_bionic-lineage-17.1.tar.bz2
android_bionic-lineage-17.1.zip
android_getaddrinfo_proxy: fix memory leak on failure.lineage-17.1
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
-rw-r--r--libc/dns/net/getaddrinfo.c2
1 files changed, 1 insertions, 1 deletions
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;
}