Skip to content

memory leak in xmlTextWriterStartElementNS #19825

@chongwick

Description

@chongwick

Description

The following code:

<?php
$v_31594 = xmlwriter_open_memory();
$v_31616 = xmlwriter_end_element($v_31594,);
$v_31621 = True;
$v_31622 = xmlwriter_flush($v_31594,$v_31621,);
$v_31606 = 'urn:ns1';
$v_31605 = 'child1';
$v_31617 = 'empty';
$v_31618 = xmlwriter_start_element($v_31594,$v_31617,);
$v_31604 = 'ns1';
$v_31607 = xmlwriter_start_element_ns($v_31594,$v_31604,$v_31605,$v_31606,);

Resulted in this output:

=================================================================
==2773144==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x6810bd in malloc (/home/w023dtc/nightly_php/php-src/sapi/cli/php+0x6810bd)
    #1 0x14fad1764afc in xmlTextWriterStartElementNS (/lib/x86_64-linux-gnu/libxml2.so.2+0x14aafc)

Indirect leak of 10 byte(s) in 1 object(s) allocated from:
    #0 0x6813d9 in realloc (/home/w023dtc/nightly_php/php-src/sapi/cli/php+0x6813d9)
    #1 0x14fad16fdd22  (/lib/x86_64-linux-gnu/libxml2.so.2+0xe3d22)

Indirect leak of 8 byte(s) in 1 object(s) allocated from:
    #0 0x6810bd in malloc (/home/w023dtc/nightly_php/php-src/sapi/cli/php+0x6810bd)
    #1 0x14fad16fd7c2 in xmlStrdup (/lib/x86_64-linux-gnu/libxml2.so.2+0xe37c2)

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

PHP Version

nightly

Operating System

ubuntu 22.04

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions