]> granicus.if.org Git - php/commitdiff
Fixed bug #43954 (Memory leak when sending the same HTTP status code more than once.)
authorScott MacVicar <scottmac@php.net>
Mon, 28 Jan 2008 16:08:14 +0000 (16:08 +0000)
committerScott MacVicar <scottmac@php.net>
Mon, 28 Jan 2008 16:08:14 +0000 (16:08 +0000)
main/SAPI.c

index 3019ddd150beb2be5208c6ac858d218244aed5c9..f4c8d7525ee959bad258b56521276ffca5312f16 100644 (file)
@@ -616,6 +616,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 {