Skip to content

DOM memory leak #17145

Description

@YuanchengJiang

Description

The following code:

<?php
$element = new DOMElement("N", "W", "y");
$attr = new DOMAttr("c" , "n");
$doc = new DOMDocument();
$doc->appendChild($element);
$element->setAttributeNodeNS($attr);
$attr->appendChild($doc->createEntityReference('amp'));
var_dump(get_defined_vars());

Resulted in this output:

==423827==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 6 byte(s) in 3 object(s) allocated from:
    #0 0x6807fd in malloc (/home/phpfuzz/WorkSpace/flowfusion/php-src/sapi/cli/php+0x6807fd)
    #1 0x7f5aae2356e3 in xmlStrndup (/lib/x86_64-linux-gnu/libxml2.so.2+0xe36e3)

SUMMARY: AddressSanitizer: 6 byte(s) leaked in 3 allocation(s).

PHP Version

nightly

Operating System

ubuntu 22.04

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions