notfound 821358 2.2.1-9
found 821358 2.22-0experimental0
tags 821358 + patch

I sent this patch upstream.  Since it only touches nss_hesiod, which is 
completely broken otherwise, it should be very low risk.

https://sourceware.org/ml/libc-alpha/2016-04/msg00563.html


2016-04-22  Anders Kaseorg  <ande...@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);
 }


Anders

Reply via email to