From: Anton Lavrentiev <lavr@ncbi.nlm.nih.gov>
To: cygwin-patches@cygwin.com
Subject: [PATCH] Cygwin: resolver: A few fixes for cygwin_query(), part 2
Date: Tue, 18 Jan 2022 19:07:55 -0500 [thread overview]
Message-ID: <20220119000755.1324-1-lavr@ncbi.nlm.nih.gov> (raw)
Make sure Windows ResultSet is free'd when dn_comp failed internally
---
winsup/cygwin/libc/minires-os-if.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/winsup/cygwin/libc/minires-os-if.c b/winsup/cygwin/libc/minires-os-if.c
index 5da1c0c55..c6fde776a 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);
--
2.33.0
next reply other threads:[~2022-01-19 0:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-19 0:07 Anton Lavrentiev [this message]
2022-01-19 7:55 ` Corinna Vinschen
2022-01-19 13:12 Lavrentiev, Anton (NIH/NLM/NCBI) [C]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220119000755.1324-1-lavr@ncbi.nlm.nih.gov \
--to=lavr@ncbi.nlm.nih.gov \
--cc=cygwin-patches@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).