aboutsummaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorAnton Lavrentiev via Cygwin-patches <cygwin-patches@cygwin.com>2022-01-18 19:07:55 -0500
committerCorinna Vinschen <corinna@vinschen.de>2022-01-19 08:05:18 +0100
commit099d5a9a57838e519bfc1fb7f9c1dc8be002e6b2 (patch)
tree9b5d8ec2a4bae92d11977c77dba3dffbbfd4c3bb /winsup
parent54f0590a661fc76036a524ca81b9d5375402c233 (diff)
downloadnewlib-099d5a9a57838e519bfc1fb7f9c1dc8be002e6b2.zip
newlib-099d5a9a57838e519bfc1fb7f9c1dc8be002e6b2.tar.gz
newlib-099d5a9a57838e519bfc1fb7f9c1dc8be002e6b2.tar.bz2
Cygwin: resolver: A few fixes for cygwin_query(), part 2
Make sure Windows ResultSet is free'd when dn_comp failed internally
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/libc/minires-os-if.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/winsup/cygwin/libc/minires-os-if.c b/winsup/cygwin/libc/minires-os-if.c
index 5da1c0c..c6fde77 100644
--- a/winsup/cygwin/libc/minires-os-if.c
+++ b/winsup/cygwin/libc/minires-os-if.c
@@ -246,8 +246,7 @@ static int cygwin_query(res_state statp, const char * DomName, int Class, int Ty
statp->res_h_errno = NO_RECOVERY;
break;
}
- len = -1;
- goto done;
+ return -1;
}
ptr = AnsPtr + HFIXEDSZ; /* Skip header */
@@ -293,10 +292,12 @@ static int cygwin_query(res_state statp, const char * DomName, int Class, int Ty
rr = rr->pNext;
}
- DnsFree(pQueryResultsSet, DnsFreeRecordList);
-
len = ptr - AnsPtr;
+
done:
+
+ DnsFree(pQueryResultsSet, DnsFreeRecordList);
+
if (HFIXEDSZ <= AnsLength) {
ptr = AnsPtr;
PUTSHORT(Id, ptr);