Skip to content

Commit 3a4ce5d

Browse files
committed
Test fix for leaks
1 parent 29e5ead commit 3a4ce5d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Zend/zend_constants.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,5 +571,10 @@ ZEND_API zend_result zend_register_constant(zend_string *name, zend_constant *c)
571571
ZEND_API zend_result zend_register_internal_constant(const char *name, size_t name_len, zend_constant *c) {
572572
zend_string *name_str = zend_string_init_interned(name, name_len, ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT);
573573

574-
return zend_register_constant(name_str, c);
574+
zend_result result = zend_register_constant(name_str, c);
575+
if (result == FAILURE) {
576+
zend_string_release(name_str);
577+
}
578+
579+
return result;
575580
}

ext/com_dotnet/com_typeinfo.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ PHP_COM_DOTNET_API zend_result php_com_import_typelib(ITypeLib *TL, int mode, in
234234
name = const_name;
235235
}
236236
zend_register_constant(name, &c);
237+
zend_string_release(name);
237238
}
238239
ITypeInfo_ReleaseVarDesc(TypeInfo, pVarDesc);
239240
}

0 commit comments

Comments
 (0)