]> git.feebdaed.xyz Git - 0xmirror/nginx.git/commitdiff
Auth basic: fixed file descriptor leak on memory allocation error.
authorSergey Kandaurov <pluknet@nginx.com>
Fri, 8 Aug 2025 15:44:27 +0000 (19:44 +0400)
committerpluknet <pluknet@nginx.com>
Mon, 11 Aug 2025 16:57:47 +0000 (20:57 +0400)
Found by Coverity (CID 1662016).

src/http/modules/ngx_http_auth_basic_module.c

index 02d41e88a95e0db3d6bf5b8e7af331de2db8887e..69e8d216118906c8696a026526d34de5f1ba5766 100644 (file)
@@ -253,7 +253,8 @@ ngx_http_auth_basic_handler(ngx_http_request_t *r)
         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);