summaryrefslogtreecommitdiff
path: root/sapi/apache/mod_php5.c
diff options
context:
space:
mode:
authorBrian France <bfrance@php.net>2006-10-12 20:02:58 +0000
committerBrian France <bfrance@php.net>2006-10-12 20:02:58 +0000
commit33879eceb3ac0cb6f97b8029da5e1e32d20ab361 (patch)
tree5bd9e2e55e2d0a3dd2f9fa229cb8f8fbac39db7c /sapi/apache/mod_php5.c
parentd087c87ffe9fbab6060c1d28cab0a6bf00752c7c (diff)
downloadphp-git-33879eceb3ac0cb6f97b8029da5e1e32d20ab361.tar.gz
Memory assigned to the request_rec should be allocated from apache pools
and should not be free'ed at the end of the handler phase
Diffstat (limited to 'sapi/apache/mod_php5.c')
-rw-r--r--sapi/apache/mod_php5.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/sapi/apache/mod_php5.c b/sapi/apache/mod_php5.c
index a6d18f9705..719a193232 100644
--- a/sapi/apache/mod_php5.c
+++ b/sapi/apache/mod_php5.c
@@ -209,7 +209,6 @@ static int sapi_apache_header_handler(sapi_header_struct *sapi_header, sapi_head
static int sapi_apache_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
{
request_rec *r = SG(server_context);
- char *status_buf = NULL;
const char *sline = SG(sapi_headers).http_status_line;
int sline_len;
@@ -223,11 +222,10 @@ static int sapi_apache_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
* the status-code: */
if (sline && ((sline_len = strlen(sline)) > 12) && strncmp(sline, "HTTP/1.", 7) == 0 && sline[8] == ' ' && sline[12] == ' ') {
if ((sline_len - 9) > MAX_STATUS_LENGTH) {
- status_buf = estrndup(sline + 9, MAX_STATUS_LENGTH);
+ r->status_line = ap_pstrndup(r->pool, sline + 9, MAX_STATUS_LENGTH);
} else {
- status_buf = estrndup(sline + 9, sline_len - 9);
+ r->status_line = ap_pstrndup(r->pool, sline + 9, sline_len - 9);
}
- r->status_line = status_buf;
}
if(r->status==304) {
@@ -235,9 +233,6 @@ static int sapi_apache_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
} else {
send_http_header(r);
}
- if (status_buf) {
- efree(status_buf);
- }
return SAPI_HEADER_SENT_SUCCESSFULLY;
}
/* }}} */