php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login

Patch max_execution_time-prevent_double_free.patch for Reproducible crash Bug #49484

Patch version 2010-03-13 08:17 UTC

Return to Bug #49484 | Download this patch
Patch Revisions:

Developer: witekfl@gazeta.pl

diff -up php-5.2.13/main/main.c.bb php-5.2.13/main/main.c
--- php-5.2.13/main/main.c.bb	2010-03-12 10:21:36.000000000 +0100
+++ php-5.2.13/main/main.c	2010-03-12 10:29:13.000000000 +0100
@@ -833,10 +833,16 @@ static void php_error_cb(int type, const
 	/* store the error if it has changed */
 	if (display) {
 		if (PG(last_error_message)) {
-			free(PG(last_error_message));
+			char *tmp = PG(last_error_message);
+
+			PG(last_error_message) = NULL;
+			free(tmp);
 		}
 		if (PG(last_error_file)) {
-			free(PG(last_error_file));
+			char *tmp = PG(last_error_file);
+
+			PG(last_error_file) = NULL;
+			free(tmp);
 		}
 		if (!error_filename) {
 			error_filename = "Unknown";
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 11:01:32 2024 UTC