[PATCH] Fix resource leak - sockaddr is not properly freed

Lubos Uhliarik luhliari at redhat.com
Thu Mar 3 01:11:26 UTC 2022


 # HG changeset patch
# User Lubos Uhliarik <luhliari at redhat.com>
# Date 1646269812 -3600
#      Thu Mar 03 02:10:12 2022 +0100
# Node ID 317e1e4b0c7343c49e0e13fc59ac75a565521b67
# Parent  a736a7a613ea6e182ff86fbadcb98bb0f8891c0b
Fix resource leak - sockaddr is not properly freed

sockaddr variable is allocated by ngx_resolver_calloc function but then it
is
going out of scope leaking the storage it points to.

diff -r a736a7a613ea -r 317e1e4b0c73 src/core/ngx_resolver.c
--- a/src/core/ngx_resolver.c   Tue Feb 08 17:35:27 2022 +0300
+++ b/src/core/ngx_resolver.c   Thu Mar 03 02:10:12 2022 +0100
@@ -4260,6 +4260,8 @@
     }
 #endif

+    ngx_resolver_free(r, sockaddr);
+
     return dst;
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20220303/22f73af2/attachment.htm>


More information about the nginx-devel mailing list