﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
1923	Potential Memory Leak in directory 'src/core'. file 'ngx_inet.c'	wp02855@…		"In reviewing source code in nginx-1.15.0, it would appear that there are some memory leaks in file 'ngx_inet.c' which when functions in this file are called, the memory allocations are not released, leading to over-utilization of memory over time, the patch file is below:

--- ngx_inet.c.orig     2019-12-12 12:03:25.414107400 -0800
+++ ngx_inet.c  2019-12-12 12:13:22.386814300 -0800
@@ -751,6 +751,7 @@
 
     saun = ngx_pcalloc(pool, sizeof(struct sockaddr_un));
     if (saun == NULL) {
+       ngx_pfree(u->addrs);    /* release memory from u->addrs */
         return NGX_ERROR;
     }
 
@@ -913,6 +914,7 @@
 
         sin = ngx_pcalloc(pool, sizeof(struct sockaddr_in));
         if (sin == NULL) {
+           ngx_pfree(u->addrs);    /* release memory from u->addrs */
             return NGX_ERROR;
         }
 
@@ -1070,6 +1072,7 @@
 
     sin6 = ngx_pcalloc(pool, sizeof(struct sockaddr_in6));
     if (sin6 == NULL) {
+       ngx_pfree(u->addrs);    /* release memory from u->addrs */
         return NGX_ERROR;
     }
 
@@ -1296,6 +1299,7 @@
 
             sin = ngx_pcalloc(pool, sizeof(struct sockaddr_in));
             if (sin == NULL) {
+               ngx_pfree(u->addrs);    /* release memory allocated to u->addrs */
                 return NGX_ERROR;
             }
 
@@ -1310,6 +1314,8 @@
 
             p = ngx_pnalloc(pool, len);
             if (p == NULL) {
+               ngx_pfree(sin); /* release memory allocated to sin */
+               ngx_pfree(u->addrs); /* release memory allocated to u->addrs */
                 return NGX_ERROR;
             }
 
@@ -1331,6 +1337,7 @@
 
         sin = ngx_pcalloc(pool, sizeof(struct sockaddr_in));
         if (sin == NULL) {
+           ngx_pfree(u->addrs);    /*  release memory assigned to u->addrs */
             return NGX_ERROR;
         }
 
@@ -1345,6 +1352,8 @@
 
         p = ngx_pnalloc(pool, u->host.len + sizeof("":65535"") - 1);
         if (p == NULL) {
+           ngx_pfree(sin); /*  release memory assigned to sin */
+           ngx_pfree(u->addrs);    /*  release memory assigned to u->addrs */
             return NGX_ERROR;
         }"	defect	closed	minor		nginx-core	1.15.x	duplicate			bill@foobar 4.4.0-18362-Microsoft #476-Microsoft Fri Nov 01 16:53:00 PST 2019 x86_64 GNU/Linux 	nginx -V: version 1.15.0 (using static analysis of source code) 
