efree crashes apache

From: Date: Mon, 05 Nov 2001 18:21:47 +0000
Subject: efree crashes apache
Groups: php.qa 
Request: Send a blank email to php-qa+get-3776@lists.php.net to get a copy of this message
Hi I dont know if this is the right group for this, but I'll give it a try : I'm coding an extension to php, but get a strange problem when using emalloc and efree. Here is an example: PHP_FUNCTION(my_test) { char *message; message = emalloc(2048); another_func_filling_message(&message); another_funct_using_message(&message); /* finished, now we can free it */ efree(message); /* This fails */ } emalloc works, but when trying to use efree, the httpd child gets an SIGTERM and all instances of httpd stops. If commenting out the efree call, httpd does not crash, but php sends and error message to httpd's error log saying :.... Freeing 0xADDRESS (2048 bytes), script=.... which sounds ok... Why does'nt it want the efree ? I have checked that the pointer (message) is the same as the original allocated after the two function calls using it. The two functions does not realloc the pointer.... My php version is 4.0.6, and apache version 1.3.19 Kind regards Arne

« previous php.qa (#3776) next »