summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_php_sapi.c
diff options
context:
space:
mode:
authorAndrew Clayton <a.clayton@nginx.com>2023-11-15 03:34:49 +0000
committerAndrew Clayton <a.clayton@nginx.com>2023-11-15 03:34:49 +0000
commit919cae7ff95a3ce5878731a8d23f34c75489d3b4 (patch)
treee82a37e14a785b3952ab312cdcfae127efbe76d7 /src/nxt_php_sapi.c
parent27c787f437ba94073d3349625c98c6d5c0a127ba (diff)
downloadunit-919cae7ff95a3ce5878731a8d23f34c75489d3b4.tar.gz
unit-919cae7ff95a3ce5878731a8d23f34c75489d3b4.tar.bz2
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: bebc03c72 ("PHP: Implement better error handling.") Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to 'src/nxt_php_sapi.c')
-rw-r--r--src/nxt_php_sapi.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/nxt_php_sapi.c b/src/nxt_php_sapi.c
index ba000fc0..77117533 100644
--- a/src/nxt_php_sapi.c
+++ b/src/nxt_php_sapi.c
@@ -1225,6 +1225,8 @@ nxt_php_execute(nxt_php_run_ctx_t *ctx, nxt_unit_request_t *r)
nxt_unit_req_debug(ctx->req, "php_request_startup() failed");
nxt_unit_request_done(ctx->req, NXT_UNIT_ERROR);
+ fclose(fp);
+
return;
}