Skip to content

Commit 034f15b

Browse files
committed
Auth basic: fixed file descriptor leak on memory allocation error.
Found by Coverity (CID 1662016).
1 parent 251444f commit 034f15b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/http/modules/ngx_http_auth_basic_module.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,8 @@ ngx_http_auth_basic_handler(ngx_http_request_t *r)
253253
pwd.len = i - passwd;
254254
pwd.data = ngx_pnalloc(r->pool, pwd.len + 1);
255255
if (pwd.data == NULL) {
256-
return NGX_HTTP_INTERNAL_SERVER_ERROR;
256+
rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
257+
goto cleanup;
257258
}
258259

259260
ngx_cpystrn(pwd.data, &buf[passwd], pwd.len + 1);

0 commit comments

Comments
 (0)