Skip to content

Commit 61e9b0d

Browse files
committed
Fixed memory leak
1 parent 050d7e3 commit 61e9b0d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ext/libxml/libxml.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,10 @@ PHP_LIBXML_API void php_libxml_error_handler(void *ctx, const char *msg, ...)
728728
va_end(args);
729729
}
730730

731+
static void php_libxml_exports_dtor(zval *zv)
732+
{
733+
free(Z_PTR_P(zv));
734+
}
731735

732736
PHP_LIBXML_API void php_libxml_initialize(void)
733737
{
@@ -738,7 +742,7 @@ PHP_LIBXML_API void php_libxml_initialize(void)
738742
_php_libxml_default_entity_loader = xmlGetExternalEntityLoader();
739743
xmlSetExternalEntityLoader(_php_libxml_pre_ext_ent_loader);
740744

741-
zend_hash_init(&php_libxml_exports, 0, NULL, NULL, 1);
745+
zend_hash_init(&php_libxml_exports, 0, NULL, php_libxml_exports_dtor, 1);
742746

743747
_php_libxml_initialized = 1;
744748
}

0 commit comments

Comments
 (0)