changeset 9445:646f12914bf8

Auth basic: fixed file descriptor leak on memory allocation error. Found by Coverity (CID 1662016).
author Sergey Kandaurov <pluknet@nginx.com>
date Fri, 08 Aug 2025 19:44:27 +0400
parents 741cc85a6778
children fc7c24cf42fa
files src/http/modules/ngx_http_auth_basic_module.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/modules/ngx_http_auth_basic_module.c	Wed Jul 09 19:02:09 2025 +0400
+++ b/src/http/modules/ngx_http_auth_basic_module.c	Fri Aug 08 19:44:27 2025 +0400
@@ -253,7 +253,8 @@
         pwd.len = i - passwd;
         pwd.data = ngx_pnalloc(r->pool, pwd.len + 1);
         if (pwd.data == NULL) {
-            return NGX_HTTP_INTERNAL_SERVER_ERROR;
+            rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
+            goto cleanup;
         }
 
         ngx_cpystrn(pwd.data, &buf[passwd], pwd.len + 1);