Skip to content

Commit 5b6cdb9

Browse files
committed
fpm: fix leaks and one use-after-free in sad paths of fpm_status_handle_request
1 parent 5130807 commit 5b6cdb9

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎sapi/fpm/fpm/fpm_status.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -914,17 +914,19 @@ int fpm_status_handle_request(void) /* {{{ */
914914
sapi_add_header_ex(ZEND_STRL("Expires: Thu, 01 Jan 1970 00:00:00 GMT"), 1, 1);
915915
sapi_add_header_ex(ZEND_STRL("Cache-Control: no-cache, no-store, must-revalidate, max-age=0"), 1, 1);
916916
PUTS("Internal error. Please review log file for errors.");
917+
zend_string_release_ex(_GET_str, 0);
917918
return 1;
918919
}
919920

920921
if (scoreboard_p->idle < 0 || scoreboard_p->active < 0) {
921-
fpm_scoreboard_free_copy(scoreboard_p);
922922
zlog(ZLOG_ERROR, "[pool %s] invalid status values", scoreboard_p->pool);
923923
SG(sapi_headers).http_response_code = 500;
924924
sapi_add_header_ex(ZEND_STRL("Content-Type: text/plain"), 1, 1);
925925
sapi_add_header_ex(ZEND_STRL("Expires: Thu, 01 Jan 1970 00:00:00 GMT"), 1, 1);
926926
sapi_add_header_ex(ZEND_STRL("Cache-Control: no-cache, no-store, must-revalidate, max-age=0"), 1, 1);
927927
PUTS("Internal error. Please review log file for errors.");
928+
zend_string_release_ex(_GET_str, 0);
929+
fpm_scoreboard_free_copy(scoreboard_p);
928930
return 1;
929931
}
930932

@@ -935,6 +937,7 @@ int fpm_status_handle_request(void) /* {{{ */
935937

936938
/* handle HEAD */
937939
if (SG(request_info).headers_only) {
940+
zend_string_release_ex(_GET_str, 0);
938941
fpm_scoreboard_free_copy(scoreboard_p);
939942
return 1;
940943
}

0 commit comments

Comments
 (0)