Skip to content

Commit 919cae7

Browse files
committed
PHP: Fix a possible file-pointer leak.
In nxt_php_execute() it is possible we could bail out before cleaning up the FILE * representing the PHP script to execute. At this point we only need to call fclose(3) on it. We could have possibly moved the opening of this file to later in the function, but it is probably good to bail out as early as possible if we can't open it. This was found by Coverity. Fixes: bebc03c ("PHP: Implement better error handling.") Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
1 parent 27c787f commit 919cae7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/nxt_php_sapi.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,6 +1225,8 @@ nxt_php_execute(nxt_php_run_ctx_t *ctx, nxt_unit_request_t *r)
12251225
nxt_unit_req_debug(ctx->req, "php_request_startup() failed");
12261226

12271227
nxt_unit_request_done(ctx->req, NXT_UNIT_ERROR);
1228+
fclose(fp);
1229+
12281230
return;
12291231
}
12301232

0 commit comments

Comments
 (0)