From 20809972dc40530fd36a1e8c4d718f84d431e60a Mon Sep 17 00:00:00 2001 From: Scott MacVicar Date: Mon, 28 Jan 2008 16:12:55 +0000 Subject: [PATCH] MFH: Fixed bug #43954 (Memory leak when sending the same HTTP status code more than once.) --- NEWS | 2 ++ main/SAPI.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/NEWS b/NEWS index 178722681c..f95f70d2d4 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,8 @@ PHP NEWS which to group by data is specified. (Ilia) - Upgraded PCRE to version 7.5 (Nuno) +- Fixed bug #43954 (Memory leak when sending the same HTTP status code + multiple times). (Scott) - Fixed faulty fix for bug #40189 (endless loop in zlib.inflate stream filter). (Greg) - Fixed bug #43912 (Interbase column names are truncated to 31 characters). diff --git a/main/SAPI.c b/main/SAPI.c index 9730d401fb..a5699252b1 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -593,6 +593,10 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) && !strncasecmp(header_line, "HTTP/", 5)) { /* filter out the response code */ sapi_update_response_code(sapi_extract_response_code(header_line) TSRMLS_CC); + /* sapi_update_response_code doesn't free the status line if the code didn't change */ + if (SG(sapi_headers).http_status_line) { + efree(SG(sapi_headers).http_status_line); + } SG(sapi_headers).http_status_line = header_line; return SUCCESS; } else { -- 2.40.0