diff options
author | Thies C. Arntzen <thies@php.net> | 1999-12-08 14:40:46 +0000 |
---|---|---|
committer | Thies C. Arntzen <thies@php.net> | 1999-12-08 14:40:46 +0000 |
commit | 276c0a378df910c3fa6f28c8b8bb2f45f4b2a975 (patch) | |
tree | 2531fd6f5457c0e1beffd0937c2187c6f2b2d39f | |
parent | f7089e600fd6f087987f19acd9c340e945c96650 (diff) | |
download | php-git-276c0a378df910c3fa6f28c8b8bb2f45f4b2a975.tar.gz |
(unserialize) now cleans up better on failure!
-rw-r--r-- | ext/standard/var.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/ext/standard/var.c b/ext/standard/var.c index acd1cc07ed..233d23b349 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -428,7 +428,6 @@ int php_var_unserialize(pval **rval, const char **p, const char *max) (*p)++; } if (**p != ':' || *((*p) + 1) != '{') { - pval_destructor(*rval); return 0; } for ((*p) += 2; **p && **p != '}' && i > 0; i--) { @@ -436,13 +435,11 @@ int php_var_unserialize(pval **rval, const char **p, const char *max) pval *data = emalloc(sizeof(pval)); if (!php_var_unserialize(&key, p, max)) { - pval_destructor(*rval); efree(key); efree(data); return 0; } if (!php_var_unserialize(&data, p, max)) { - pval_destructor(*rval); pval_destructor(key); efree(key); efree(data); @@ -503,6 +500,7 @@ PHP_FUNCTION(unserialize) } if (!php_var_unserialize(&return_value, &p, p + (*buf)->value.str.len)) { + zval_dtor(return_value); php_error(E_NOTICE, "unserialize() failed at offset %d of %d bytes",p-(*buf)->value.str.val,(*buf)->value.str.len); RETURN_FALSE; } |