public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] hesiod_end: Do not call res_nclose(&_res) [BZ #19573]
@ 2016-04-22 18:25 Anders Kaseorg
  2016-04-23 12:30 ` Florian Weimer
  0 siblings, 1 reply; 8+ messages in thread
From: Anders Kaseorg @ 2016-04-22 18:25 UTC (permalink / raw)
  To: libc-alpha

2016-04-22  Anders Kaseorg  <andersk@mit.edu>

	[BZ #19573]
	* hesiod/hesiod.c (hesiod_end): Only call res_nclose(ctx->res) if
	ctx->free_res is nonnull, to prevent a crash on res_nclose(&res)
	introduced by commit 2212c1420c92a33b0e0bd9a34938c9814a56c0f7
	(Simplify handling of nameserver configuration in resolver).

diff --git a/hesiod/hesiod.c b/hesiod/hesiod.c
index 657dabe..a540382 100644
--- a/hesiod/hesiod.c
+++ b/hesiod/hesiod.c
@@ -152,12 +152,12 @@ hesiod_end(void *context) {
 	struct hesiod_p *ctx = (struct hesiod_p *) context;
 	int save_errno = errno;
 
-	if (ctx->res)
+	if (ctx->res && ctx->free_res) {
 		res_nclose(ctx->res);
+		(*ctx->free_res)(ctx->res);
+	}
 	free(ctx->RHS);
 	free(ctx->LHS);
-	if (ctx->res && ctx->free_res)
-		(*ctx->free_res)(ctx->res);
 	free(ctx);
 	__set_errno(save_errno);
 }

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-05-02 10:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-22 18:25 [PATCH] hesiod_end: Do not call res_nclose(&_res) [BZ #19573] Anders Kaseorg
2016-04-23 12:30 ` Florian Weimer
2016-04-23 18:37   ` Anders Kaseorg
2016-04-27 15:36     ` Anders Kaseorg
2016-04-27 18:19       ` Florian Weimer
2016-04-30 23:17         ` Anders Kaseorg
2016-05-02 10:02           ` Florian Weimer
2016-05-02 10:16             ` Anders Kaseorg

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).