cvs: php4 /main SAPI.c
| From: | Marcus B�rger | Date: | Thu, 01 Aug 2002 09:00:31 +0000 |
| Subject: | cvs: php4 /main SAPI.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-13074@lists.php.net to get a copy of this message | ||
helly Thu Aug 1 05:00:31 2002 EDT
Modified files:
/php4/main SAPI.c
Log:
- free mimetype and statusline early if no longer needed or in deactivation
#not setting them to NULL caused the segfault
Index: php4/main/SAPI.c
diff -u php4/main/SAPI.c:1.140 php4/main/SAPI.c:1.141
--- php4/main/SAPI.c:1.140 Thu Aug 1 03:49:53 2002
+++ php4/main/SAPI.c Thu Aug 1 05:00:30 2002
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: SAPI.c,v 1.140 2002/08/01 07:49:53 rasmus Exp $ */
+/* $Id: SAPI.c,v 1.141 2002/08/01 09:00:30 helly Exp $ */
#include <ctype.h>
#include <sys/stat.h>
@@ -338,6 +338,18 @@
}
+static void sapi_send_headers_free(TSRMLS_D)
+{
+ if (SG(sapi_headers).http_status_line) {
+ efree(SG(sapi_headers).http_status_line);
+ SG(sapi_headers).http_status_line = NULL;
+ }
+ if (SG(sapi_headers).mimetype) {
+ efree(SG(sapi_headers).mimetype);
+ SG(sapi_headers).mimetype = NULL;
+ }
+}
+
SAPI_API void sapi_deactivate(TSRMLS_D)
{
zend_llist_destroy(&SG(sapi_headers).headers);
@@ -362,6 +374,7 @@
if (SG(rfc1867_uploaded_files)) {
destroy_uploaded_files_hash(TSRMLS_C);
}
+ sapi_send_headers_free(TSRMLS_C);
}
@@ -633,23 +646,12 @@
}
-static void sapi_send_headers_free(TSRMLS_D)
-{
- if (SG(sapi_headers).http_status_line) {
- efree(SG(sapi_headers).http_status_line);
- }
- if (SG(sapi_headers).mimetype) {
- efree(SG(sapi_headers).mimetype);
- }
-}
-
SAPI_API int sapi_send_headers(TSRMLS_D)
{
int retval;
int ret = FAILURE;
if (SG(headers_sent) || SG(request_info).no_headers) {
- sapi_send_headers_free(TSRMLS_C);
return SUCCESS;
}