mirror of
https://github.com/php/php-src.git
synced 2026-04-03 06:02:23 +02:00
Fix memleak in serialize
This commit is contained in:
@@ -598,6 +598,7 @@ static void php_var_serialize_class(smart_str *buf, zval **struc, zval *retval_p
|
||||
php_var_serialize_intern(buf, d, var_hash TSRMLS_CC);
|
||||
break;
|
||||
}
|
||||
efree(priv_name);
|
||||
zend_mangle_property_name(&prot_name, &prop_name_length, "*", 1,
|
||||
Z_STRVAL_PP(name), Z_STRLEN_PP(name) + 1, ce->type & ZEND_INTERNAL_CLASS);
|
||||
if (zend_hash_find(Z_OBJPROP_PP(struc), prot_name, prop_name_length, (void *) &d) == SUCCESS) {
|
||||
@@ -606,12 +607,10 @@ static void php_var_serialize_class(smart_str *buf, zval **struc, zval *retval_p
|
||||
php_var_serialize_intern(buf, d, var_hash TSRMLS_CC);
|
||||
break;
|
||||
}
|
||||
efree(prot_name);
|
||||
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "\"%s\" returned as member variable from __sleep() but does not exist", Z_STRVAL_PP(name));
|
||||
php_var_serialize_string(buf, Z_STRVAL_PP(name), Z_STRLEN_PP(name));
|
||||
php_var_serialize_intern(buf, &nvalp, var_hash TSRMLS_CC);
|
||||
|
||||
efree(prot_name);
|
||||
efree(priv_name);
|
||||
} while (0);
|
||||
} else {
|
||||
php_var_serialize_string(buf, Z_STRVAL_PP(name), Z_STRLEN_PP(name));
|
||||
|
||||
Reference in New Issue
Block a user