[php-src] Issue #15513: Memory Leak in xmlCreateIntSubset
| From: | chongwick | Date: | Wed, 21 Aug 2024 01:05:57 +0000 |
| Subject: | [php-src] Issue #15513: Memory Leak in xmlCreateIntSubset | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247554@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/15513
Author: chongwick
### Description
The following code:
```php
<?php
$doc = new DOMDocument();
$impl = $doc->implementation;
$doctype = $impl->createDocumentType('mydoctype');
$doc->appendChild($doctype);
```
Resulted in this output:
```
==315744==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 128 byte(s) in 1 object(s) allocated from:
#0 0x154baae76887 in __interceptor_malloc
../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
#1 0x154baab5af6c in xmlCreateIntSubset (/lib/x86_64-linux-gnu/libxml2.so.2+0x61f6c)
Indirect leak of 10 byte(s) in 1 object(s) allocated from:
#0 0x154baae76887 in __interceptor_malloc
../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
#1 0x154baabdc7f2 in xmlStrdup (/lib/x86_64-linux-gnu/libxml2.so.2+0xe37f2)
SUMMARY: AddressSanitizer: 138 byte(s) leaked in 2 allocation(s).
```
USE_ZEND_ALLOC=1 php script.php
### PHP Version
PHP 8.3.8
### Operating System
_No response_