Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merged pull request #202
  • Loading branch information
derickr committed Sep 5, 2015
2 parents 448f5b6 + 40ae961 commit 1286d0f
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 2 deletions.
12 changes: 11 additions & 1 deletion xdebug.c
Expand Up @@ -172,11 +172,15 @@ zend_module_entry xdebug_module_entry = {
STANDARD_MODULE_PROPERTIES_EX
};


ZEND_DECLARE_MODULE_GLOBALS(xdebug)

#if COMPILE_DL_XDEBUG
ZEND_GET_MODULE(xdebug)
#if PHP_VERSION_ID >= 70000
# ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE();
# endif
#endif
#endif

static PHP_INI_MH(OnUpdateServer)
Expand Down Expand Up @@ -1020,6 +1024,12 @@ PHP_RINIT_FUNCTION(xdebug)
zval **dummy;
#endif

#if PHP_VERSION_ID >= 70000
#if defined(ZTS) && defined(COMPILE_DL_XDEBUG)
ZEND_TSRMLS_CACHE_UPDATE();
#endif
#endif

/* Get the ide key for this session */
XG(ide_key) = NULL;
idekey = xdebug_env_key(TSRMLS_C);
Expand Down
30 changes: 30 additions & 0 deletions xdebug_code_coverage.c
Expand Up @@ -1067,10 +1067,19 @@ static void add_branches(zval *retval, xdebug_branch_info *branch_info TSRMLS_DC
add_assoc_zval(branch, "out_hit", out_hit);

add_index_zval(branches, i, branch);
#if PHP_VERSION_ID >= 70000
efree(out_hit);
efree(out);
efree(branch);
#endif
}
}

add_assoc_zval_ex(retval, "branches", 9, branches);

#if PHP_VERSION_ID >= 70000
efree(branches);
#endif
}

static void add_paths(zval *retval, xdebug_branch_info *branch_info TSRMLS_DC)
Expand All @@ -1096,9 +1105,18 @@ static void add_paths(zval *retval, xdebug_branch_info *branch_info TSRMLS_DC)
add_assoc_long(path_container, "hit", branch_info->path_info.paths[i]->hit);

add_next_index_zval(paths, path_container);

#if PHP_VERSION_ID >= 70000
efree(path_container);
efree(path);
#endif
}

add_assoc_zval_ex(retval, "paths", 6, paths);

#if PHP_VERSION_ID >= 70000
efree(paths);
#endif
}

static void add_cc_function(void *ret, xdebug_hash_element *e)
Expand All @@ -1117,6 +1135,10 @@ static void add_cc_function(void *ret, xdebug_hash_element *e)
}

add_assoc_zval_ex(retval, function->name, strlen(function->name) + 1, function_info);

#if PHP_VERSION_ID >= 70000
efree(function_info);
#endif
}

static void add_file(void *ret, xdebug_hash_element *e)
Expand Down Expand Up @@ -1155,9 +1177,17 @@ static void add_file(void *ret, xdebug_hash_element *e)
add_assoc_zval_ex(file_info, "functions", 10, functions);

add_assoc_zval_ex(retval, file->name, strlen(file->name) + 1, file_info);
#if PHP_VERSION_ID >= 70000
efree(functions);
efree(file_info);
#endif
} else {
add_assoc_zval_ex(retval, file->name, strlen(file->name) + 1, lines);
}

#if PHP_VERSION_ID >= 70000
efree(lines);
#endif
}

PHP_FUNCTION(xdebug_get_code_coverage)
Expand Down
9 changes: 8 additions & 1 deletion xdebug_stack.c
Expand Up @@ -1070,7 +1070,7 @@ static void xdebug_build_fname(xdebug_func *tmp, zend_execute_data *edata TSRMLS
if (strcmp(edata->func->common.function_name->val, "{closure}") == 0) {
tmp->function = xdebug_sprintf(
"{closure:%s:%d-%d}",
edata->func->op_array.filename,
edata->func->op_array.filename->val,
edata->func->op_array.line_start,
edata->func->op_array.line_end
);
Expand Down Expand Up @@ -1632,6 +1632,9 @@ PHP_FUNCTION(xdebug_get_function_stack)
} else {
add_index_zval(params, j, vparams);
}
#if PHP_VERSION_ID >= 70000
efree(params);
#endif
params = vparams;
variadic_opened = 1;
}
Expand All @@ -1653,6 +1656,10 @@ PHP_FUNCTION(xdebug_get_function_stack)
}

add_next_index_zval(return_value, frame);
#if PHP_VERSION_ID >= 70000
efree(params);
efree(frame);
#endif
}
}
/* }}} */
Expand Down

0 comments on commit 1286d0f

Please sign in to comment.