Skip to content

Commit 1352532

Browse files
committed
Cleanup shutdown, enable proper memory leak displaying
phpdbg should not memory leak...
1 parent bf1ecbf commit 1352532

13 files changed

+177
-177
lines changed

Zend/zend_opcode.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -343,13 +343,14 @@ ZEND_API zend_bool destroy_op_array(zend_op_array *op_array)
343343

344344
if (op_array->static_variables &&
345345
!(GC_FLAGS(op_array->static_variables) & IS_ARRAY_IMMUTABLE)) {
346-
if (--GC_REFCOUNT(op_array->static_variables) == 0) {
346+
if (--GC_REFCOUNT(op_array->static_variables) == 0) {
347347
zend_array_destroy(op_array->static_variables);
348348
}
349349
}
350350

351351
if (op_array->run_time_cache && !op_array->function_name) {
352352
efree(op_array->run_time_cache);
353+
op_array->run_time_cache = NULL;
353354
}
354355

355356
if (!op_array->refcount) {

Zend/zend_portability.h

+11-7
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ char *alloca();
175175
# endif
176176
#endif
177177

178-
#if ZEND_GCC_VERSION >= 2096
178+
#if ZEND_GCC_VERSION >= 2096 || __has_attribute(__malloc__)
179179
# define ZEND_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
180180
#else
181181
# define ZEND_ATTRIBUTE_MALLOC
@@ -221,12 +221,16 @@ char *alloca();
221221
# define ZEND_ATTRIBUTE_UNUSED_LABEL
222222
#endif
223223

224-
#if defined(__GNUC__) && ZEND_GCC_VERSION >= 3004 && defined(__i386__)
225-
# define ZEND_FASTCALL __attribute__((fastcall))
226-
#elif defined(_MSC_VER) && defined(_M_IX86) && _MSC_VER == 1700
227-
# define ZEND_FASTCALL __fastcall
228-
#elif defined(_MSC_VER) && _MSC_VER >= 1800 && !defined(__clang__)
229-
# define ZEND_FASTCALL __vectorcall
224+
#if !ZEND_DEBUG
225+
# if defined(__GNUC__) && ZEND_GCC_VERSION >= 3004 && defined(__i386__)
226+
# define ZEND_FASTCALL __attribute__((fastcall))
227+
# elif defined(_MSC_VER) && defined(_M_IX86) && _MSC_VER == 1700
228+
# define ZEND_FASTCALL __fastcall
229+
# elif defined(_MSC_VER) && _MSC_VER >= 1800 && !defined(__clang__)
230+
# define ZEND_FASTCALL __vectorcall
231+
# else
232+
# define ZEND_FASTCALL
233+
# endif
230234
#else
231235
# define ZEND_FASTCALL
232236
#endif

main/php_variables.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ zend_bool php_std_auto_global_callback(char *name, uint name_len)
524524

525525
/* {{{ php_build_argv
526526
*/
527-
static void php_build_argv(char *s, zval *track_vars_array)
527+
PHPAPI void php_build_argv(char *s, zval *track_vars_array)
528528
{
529529
zval arr, argc, tmp;
530530
int count = 0;

main/php_variables.h

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ PHPAPI void php_register_variable(char *var, char *val, zval *track_vars_array);
4141
PHPAPI void php_register_variable_safe(char *var, char *val, size_t val_len, zval *track_vars_array);
4242
PHPAPI void php_register_variable_ex(char *var, zval *val, zval *track_vars_array);
4343

44+
PHPAPI void php_build_argv(char *s, zval *track_vars_array);
4445
PHPAPI int php_hash_environment(void);
4546
END_EXTERN_C()
4647

0 commit comments

Comments
 (0)