[nginx] Resolver: fixed memory leak for the "ipv4=off" case.

Sergey Kandaurov pluknet at nginx.com
Thu Jul 14 17:31:56 UTC 2022


details:   https://hg.nginx.org/nginx/rev/0422365794f7
branches:  
changeset: 8056:0422365794f7
user:      Sergey Kandaurov <pluknet at nginx.com>
date:      Thu Jul 14 21:26:54 2022 +0400
description:
Resolver: fixed memory leak for the "ipv4=off" case.

This change partially reverts 2a77754cd9fe to properly free rn->query.

Found by Coverity (CID 1507244).

diffstat:

 src/core/ngx_resolver.c |  5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diffs (15 lines):

diff -r 2a77754cd9fe -r 0422365794f7 src/core/ngx_resolver.c
--- a/src/core/ngx_resolver.c	Tue Jul 12 21:44:02 2022 +0400
+++ b/src/core/ngx_resolver.c	Thu Jul 14 21:26:54 2022 +0400
@@ -3684,10 +3684,7 @@ ngx_resolver_create_name_query(ngx_resol
     }
 
     rn->qlen = (u_short) len;
-
-    if (r->ipv4) {
-        rn->query = p;
-    }
+    rn->query = p;
 
 #if (NGX_HAVE_INET6)
     if (r->ipv6) {



More information about the nginx-devel mailing list