Re: [PHP4BETA] CVS update: php4/ext/standard
| From: | Sascha Schumann | Date: | Fri, 28 May 1999 22:33:53 +0000 |
| Subject: | Re: [PHP4BETA] CVS update: php4/ext/standard | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-1154@lists.php.net to get a copy of this message | ||
On Fri, May 28, 1999 at 09:27:19PM -0000, sas wrote:
> Date: Friday May 28, 1999 @ 17:27
> Author: sas
>
> Update of /repository/php4/ext/standard
> In directory php:/tmp/cvs-serv24028/standard
>
> Modified Files:
> var.c
> Log Message:
> Either I'm playing the EG(symbol_table) game wrong or var.c leaks memory
> when unserializing arrays/objects. Still testing
>
> Index: php4/ext/standard/var.c
> diff -u php4/ext/standard/var.c:1.6 php4/ext/standard/var.c:1.7
> --- php4/ext/standard/var.c:1.6 Sun Apr 25 08:41:18 1999
> +++ php4/ext/standard/var.c Fri May 28 17:27:19 1999
> @@ -355,6 +355,7 @@
> return 0;
> }
> if (!php3api_var_unserialize(&data, p, max)) {
> + pval_destructor(key);
> efree(key);
> efree(data);
> return 0;
>
> --
> PHP 4 Beta
>
A short script displays the effect
<?
$a = array(1);
$dat = serialize($a);
unserialize($a);
Freeing 0x12022D260 (24 bytes), allocated in var.c on line 350<br>
for ((*p) += 2; **p && **p != '}' && i > 0; i--) {
pval *key = emalloc(sizeof(pval));
that one ... pval *data = emalloc(sizeof(pval));
It becomes funny, if one replaces array(1) with array(array(1)):
abc: Freeing 0x12022D6A0 (71 bytes), allocated in zend_hash.c on line 376<br>
abc: Freeing 0x12022D640 (24 bytes), allocated in var.c on line 350<br>
abc: Freeing 0x12022D570 (40 bytes), allocated in zend_hash.c on line 91<br>
abc: Freeing 0x12022D160 (80 bytes), allocated in var.c on line 340<br>
abc: Freeing 0x12022D510 (24 bytes), allocated in var.c on line 350<br>
abc: Freeing 0x12022D2F0 (8 bytes), allocated in zend_hash.c on line 387<br>
Anyone?
--
Regards,
Sascha Schumann
Consultant
--
PHP 4 Beta