summaryrefslogtreecommitdiff
path: root/sapi/phpdbg/phpdbg_list.c
diff options
context:
space:
mode:
authorBob Weinand <bobwei9@hotmail.com>2015-08-04 00:00:10 +0200
committerBob Weinand <bobwei9@hotmail.com>2015-08-04 00:00:10 +0200
commitd8fe645db444e54fcc8b2555c08a5021c17ca2d3 (patch)
treed2185eecbadddafeddae9d061a105b0663fe9dec /sapi/phpdbg/phpdbg_list.c
parentb20953118ba41cd9465ccc84e79b6eef3f539573 (diff)
downloadphp-git-d8fe645db444e54fcc8b2555c08a5021c17ca2d3.tar.gz
Fix valgrind errors in phpdbg
Revert "We cannot safely assume that all op array will be refcount 0 after execution" This reverts commit b6936adb58288a0606ed847802d9226cddb41e2b. This change turns out to not have been a clever idea and was causing more weirdness than it helped...
Diffstat (limited to 'sapi/phpdbg/phpdbg_list.c')
-rw-r--r--sapi/phpdbg/phpdbg_list.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/sapi/phpdbg/phpdbg_list.c b/sapi/phpdbg/phpdbg_list.c
index 8369018fc9..c30b81bc64 100644
--- a/sapi/phpdbg/phpdbg_list.c
+++ b/sapi/phpdbg/phpdbg_list.c
@@ -294,35 +294,28 @@ zend_op_array *phpdbg_compile_file(zend_file_handle *file, int type) {
zend_op_array *phpdbg_init_compile_file(zend_file_handle *file, int type) {
char *filename = (char *)(file->opened_path ? ZSTR_VAL(file->opened_path) : file->filename);
char resolved_path_buf[MAXPATHLEN];
- zend_op_array *ret;
+ zend_op_array *op_array;
phpdbg_file_source *dataptr;
if (VCWD_REALPATH(filename, resolved_path_buf)) {
filename = resolved_path_buf;
}
- ret = PHPDBG_G(init_compile_file)(file, type);
+ op_array = PHPDBG_G(init_compile_file)(file, type);
- if (ret == NULL) {
+ if (op_array == NULL) {
return NULL;
}
dataptr = zend_hash_str_find_ptr(&PHPDBG_G(file_sources), filename, strlen(filename));
ZEND_ASSERT(dataptr != NULL);
- dataptr->op_array = ret;
- dataptr->destroy_op_array = 1;
- if (dataptr->op_array) {
- if (dataptr->op_array->refcount) {
- ++*dataptr->op_array->refcount;
- } else {
- dataptr->op_array->refcount = emalloc(sizeof(uint32_t));
- *dataptr->op_array->refcount = 2;
- dataptr->destroy_op_array = 0;
- }
+ dataptr->op_array = *op_array;
+ if (dataptr->op_array.refcount) {
+ efree(op_array);
}
- return ret;
+ return &dataptr->op_array;
}
void phpdbg_free_file_source(zval *zv) {
@@ -332,12 +325,7 @@ void phpdbg_free_file_source(zval *zv) {
efree(data->buf);
}
- if (!data->destroy_op_array) {
- efree(data->op_array->refcount);
- }
- if (!data->destroy_op_array || destroy_op_array(data->op_array)) {
- efree(data->op_array);
- }
+ destroy_op_array(&data->op_array);
efree(data);
}