Fixed memory leaks

This commit is contained in:
Dmitry Stogov 2006-04-18 06:58:43 +00:00
parent 101d925baa
commit 73e4913cca
2 changed files with 8 additions and 6 deletions

View file

@ -421,10 +421,8 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC)
return;
}
ALLOC_ZVAL(arr);
ALLOC_INIT_ZVAL(arr);
array_init(arr);
arr->is_ref = 0;
arr->refcount = 0;
/* Prepare argv */
if (SG(request_info).argc) { /* are we in cli sapi? */
@ -470,15 +468,13 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC)
}
/* prepare argc */
ALLOC_ZVAL(argc);
ALLOC_INIT_ZVAL(argc);
if (SG(request_info).argc) {
Z_LVAL_P(argc) = SG(request_info).argc;
} else {
Z_LVAL_P(argc) = count;
}
Z_TYPE_P(argc) = IS_LONG;
argc->is_ref = 0;
argc->refcount = 0;
if (PG(register_globals) || SG(request_info).argc) {
arr->refcount++;
@ -492,6 +488,8 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC)
zend_hash_update(Z_ARRVAL_P(track_vars_array), "argv", sizeof("argv"), &arr, sizeof(zval *), NULL);
zend_hash_update(Z_ARRVAL_P(track_vars_array), "argc", sizeof("argc"), &argc, sizeof(zval *), NULL);
}
zval_ptr_dtor(&arr);
zval_ptr_dtor(&argc);
}
/* }}} */