Skip to content

SoapClient Memory Leak #19788

@chongwick

Description

@chongwick

Description

The following code:

<?php
$v_67388 = xmlwriter_open_memory();
$v_67389 = TRUE;
$v_67390 = xmlwriter_set_indent($v_67388,$v_67389,);
$v_67391 = '   ';
$v_67392 = xmlwriter_set_indent_string($v_67388,$v_67391,);
$v_67393 = '1.0';
$v_67394 = 'UTF-8';
$v_67395 = xmlwriter_start_document($v_67388,$v_67393,$v_67394,);
$v_67396 = 'root';
$v_67397 = xmlwriter_start_element($v_67388,$v_67396,);
$v_67493 = __DIR__;
$v_67494 = '/round4_groupI_xsd.wsdl';
$v_67495 = $v_67493 . $v_67494;
$v_67498 = 1;
$v_67500 = 0;
$v_67496 = array('trace' => $v_67498,'exceptions' => $v_67500,);
$v_67501 = new SoapClient($v_67495,$v_67496,);$v_67506 = $v_67501->__getlastrequest();

Resulted in this output:

Warning: SoapClient::__construct(): I/O warning : failed to load external entity "/home/round4_groupI_xsd.wsdl" in /home/18965dc7e39a8da24ea4.php.er on line 18

Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from '/home/round4_groupI_xsd.wsdl' : failed to load external entity "/home/round4_groupI_xsd.wsdl"
 in /home/18965dc7e39a8da24ea4.php.er on line 18
Stack trace:
#0 /home/18965dc7e39a8da24ea4.php.er(18): SoapClient->__construct('/home/round4_gr...', Array)
#1 {main}

=================================================================
==105==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 80 byte(s) in 1 object(s) allocated from:
    #0 0x6810bd in malloc (/home/php+0x6810bd)
    #1 0x150d29ca166b in xmlNewTextWriter (/lib/x86_64-linux-gnu/libxml2.so.2+0x14766b)
    #2 0x486d924 in zif_xmlwriter_open_memory /home/w023dtc/nightly_php/php-src/ext/xmlwriter/php_xmlwriter.c:920:25
    #3 0x600cf5f in ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER /home/w023dtc/nightly_php/php-src/Zend/zend_vm_execute.h:1410:2
    #4 0x5b28cf3 in execute_ex /home/w023dtc/nightly_php/php-src/Zend/zend_vm_execute.h:113454:12
    #5 0x5b2b27c in zend_execute /home/w023dtc/nightly_php/php-src/Zend/zend_vm_execute.h:119146:2
    #6 0x68ab8d9 in zend_execute_script /home/w023dtc/nightly_php/php-src/Zend/zend.c:1977:3
    #7 0x508da3a in php_execute_script_ex /home/w023dtc/nightly_php/php-src/main/main.c:2638:13
    #8 0x508eb78 in php_execute_script /home/w023dtc/nightly_php/php-src/main/main.c:2678:9
    #9 0x68c07ea in do_cli /home/w023dtc/nightly_php/php-src/sapi/cli/php_cli.c:951:5
    #10 0x68babcf in main /home/w023dtc/nightly_php/php-src/sapi/cli/php_cli.c:1362:18
    #11 0x150d29160d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16

Indirect leak of 4096 byte(s) in 1 object(s) allocated from:
    #0 0x6810bd in malloc (/home/php+0x6810bd)
    #1 0x150d29c4377c in xmlBufCreate (/lib/x86_64-linux-gnu/libxml2.so.2+0xe977c)
    #2 0x486d924 in zif_xmlwriter_open_memory /home/w023dtc/nightly_php/php-src/ext/xmlwriter/php_xmlwriter.c:920:25
    #3 0x600cf5f in ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER /home/w023dtc/nightly_php/php-src/Zend/zend_vm_execute.h:1410:2
    #4 0x5b28cf3 in execute_ex /home/w023dtc/nightly_php/php-src/Zend/zend_vm_execute.h:113454:12
    #5 0x5b2b27c in zend_execute /home/w023dtc/nightly_php/php-src/Zend/zend_vm_execute.h:119146:2
    #6 0x68ab8d9 in zend_execute_script /home/w023dtc/nightly_php/php-src/Zend/zend.c:1977:3
    #7 0x508da3a in php_execute_script_ex /home/w023dtc/nightly_php/php-src/main/main.c:2638:13
    #8 0x508eb78 in php_execute_script /home/w023dtc/nightly_php/php-src/main/main.c:2678:9
    #9 0x68c07ea in do_cli /home/w023dtc/nightly_php/php-src/sapi/cli/php_cli.c:951:5
    #10 0x68babcf in main /home/w023dtc/nightly_php/php-src/sapi/cli/php_cli.c:1362:18
    #11 0x150d29160d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16

Indirect leak of 4001 byte(s) in 1 object(s) allocated from:
    #0 0x6810bd in malloc (/home/php+0x6810bd)
    #1 0x150d29c43692 in xmlBufCreateSize (/lib/x86_64-linux-gnu/libxml2.so.2+0xe9692)

Indirect leak of 176 byte(s) in 1 object(s) allocated from:
    #0 0x6810bd in malloc (/home/php+0x6810bd)
    #1 0x150d29bbc2de in xmlNewDoc (/lib/x86_64-linux-gnu/libxml2.so.2+0x622de)

Indirect leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x6810bd in malloc (/home/php+0x6810bd)
    #1 0x150d29c43723 in xmlBufCreate (/lib/x86_64-linux-gnu/libxml2.so.2+0xe9723)
    #2 0x486d924 in zif_xmlwriter_open_memory /home/w023dtc/nightly_php/php-src/ext/xmlwriter/php_xmlwriter.c:920:25
    #3 0x600cf5f in ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER /home/w023dtc/nightly_php/php-src/Zend/zend_vm_execute.h:1410:2
    #4 0x5b28cf3 in execute_ex /home/w023dtc/nightly_php/php-src/Zend/zend_vm_execute.h:113454:12
    #5 0x5b2b27c in zend_execute /home/w023dtc/nightly_php/php-src/Zend/zend_vm_execute.h:119146:2
    #6 0x68ab8d9 in zend_execute_script /home/w023dtc/nightly_php/php-src/Zend/zend.c:1977:3
    #7 0x508da3a in php_execute_script_ex /home/w023dtc/nightly_php/php-src/main/main.c:2638:13
    #8 0x508eb78 in php_execute_script /home/w023dtc/nightly_php/php-src/main/main.c:2678:9
    #9 0x68c07ea in do_cli /home/w023dtc/nightly_php/php-src/sapi/cli/php_cli.c:951:5
    #10 0x68babcf in main /home/w023dtc/nightly_php/php-src/sapi/cli/php_cli.c:1362:18
    #11 0x150d29160d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16

Indirect leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x6810bd in malloc (/home/php+0x6810bd)
    #1 0x150d29c43605 in xmlBufCreateSize (/lib/x86_64-linux-gnu/libxml2.so.2+0xe9605)

Indirect leak of 56 byte(s) in 1 object(s) allocated from:
    #0 0x6810bd in malloc (/home/php+0x6810bd)
    #1 0x150d29bd795b in xmlAllocOutputBufferInternal (/lib/x86_64-linux-gnu/libxml2.so.2+0x7d95b)
    #2 0x486d924 in zif_xmlwriter_open_memory /home/w023dtc/nightly_php/php-src/ext/xmlwriter/php_xmlwriter.c:920:25
    #3 0x600cf5f in ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER /home/w023dtc/nightly_php/php-src/Zend/zend_vm_execute.h:1410:2
    #4 0x5b28cf3 in execute_ex /home/w023dtc/nightly_php/php-src/Zend/zend_vm_execute.h:113454:12
    #5 0x5b2b27c in zend_execute /home/w023dtc/nightly_php/php-src/Zend/zend_vm_execute.h:119146:2
    #6 0x68ab8d9 in zend_execute_script /home/w023dtc/nightly_php/php-src/Zend/zend.c:1977:3
    #7 0x508da3a in php_execute_script_ex /home/w023dtc/nightly_php/php-src/main/main.c:2638:13
    #8 0x508eb78 in php_execute_script /home/w023dtc/nightly_php/php-src/main/main.c:2678:9
    #9 0x68c07ea in do_cli /home/w023dtc/nightly_php/php-src/sapi/cli/php_cli.c:951:5
    #10 0x68babcf in main /home/w023dtc/nightly_php/php-src/sapi/cli/php_cli.c:1362:18
    #11 0x150d29160d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16

Indirect leak of 48 byte(s) in 2 object(s) allocated from:
    #0 0x6810bd in malloc (/home/php+0x6810bd)
    #1 0x150d29bcfff3 in xmlListCreate (/lib/x86_64-linux-gnu/libxml2.so.2+0x75ff3)

Indirect leak of 48 byte(s) in 2 object(s) allocated from:
    #0 0x6810bd in malloc (/home/php+0x6810bd)
    #1 0x150d29bcffd3 in xmlListCreate (/lib/x86_64-linux-gnu/libxml2.so.2+0x75fd3)

Indirect leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x6810bd in malloc (/home/php+0x6810bd)
    #1 0x150d29ca489e in xmlTextWriterStartElement (/lib/x86_64-linux-gnu/libxml2.so.2+0x14a89e)

Indirect leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0x6810bd in malloc (/home/php+0x6810bd)
    #1 0x150d29ca4860 in xmlTextWriterStartElement (/lib/x86_64-linux-gnu/libxml2.so.2+0x14a860)

Indirect leak of 11 byte(s) in 2 object(s) allocated from:
    #0 0x6810bd in malloc (/home/php+0x6810bd)
    #1 0x150d29c3d7c2 in xmlStrdup (/lib/x86_64-linux-gnu/libxml2.so.2+0xe37c2)

Indirect leak of 8 byte(s) in 2 object(s) allocated from:
    #0 0x6810bd in malloc (/home/php+0x6810bd)
    #1 0x150d29c3d6b3 in xmlStrndup (/lib/x86_64-linux-gnu/libxml2.so.2+0xe36b3)

SUMMARY: AddressSanitizer: 8692 byte(s) leaked in 17 allocation(s).

But I expected this output instead:

PHP Version

nightly

Operating System

ubuntu 22.04

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions