aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2023-12-12 16:39:01 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2023-12-12 16:39:01 +0000
commit14b322b25178850f9c1ea322e9daf95df4479af0 (patch)
tree6dc7d86d797e197c441650bc420a1b9297640085
parent00ab1a5f95cdf3dd12a382e37fe7ed7ce9ba5d7f (diff)
parent12f8ec4004b5f479a74c0297729ee0c6e3f8cd6e (diff)
downloadbionic-14b322b25178850f9c1ea322e9daf95df4479af0.tar.gz
Merge "Closing the stream when the function returns" into main
-rw-r--r--libc/dns/net/sethostent.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libc/dns/net/sethostent.c b/libc/dns/net/sethostent.c
index 483105a95..5c4bdb5ab 100644
--- a/libc/dns/net/sethostent.c
+++ b/libc/dns/net/sethostent.c
@@ -157,6 +157,7 @@ _hf_gethtbyname2(const char *name, int af, struct getnamaddr *info)
if ((ptr = buf = malloc(len = info->buflen)) == NULL) {
*info->he = NETDB_INTERNAL;
+ endhostent_r(&hf);
return NULL;
}
@@ -241,6 +242,7 @@ _hf_gethtbyname2(const char *name, int af, struct getnamaddr *info)
return hp;
nospc:
*info->he = NETDB_INTERNAL;
+ endhostent_r(&hf);
free(buf);
errno = ENOSPC;
return NULL;