# sxe, leaks while reading attributes prop without assign it to a var

- Thread: https://externals.io/message/7696
- Original archive: https://news-web.php.net/php.internals/7696
- Started by Pierre-Alain Joye on 2004-02-10T12:29:30+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #7696 — Pierre-Alain Joye — 2004-02-10T12:29:30+00:00

URL: https://externals.io/message/7696#7696

Hello,

Maybe this usage is wrong but it should not leak:

<?php
$xml =<<<EOF
<people type="foo">
   <person name="Joe">
     Text1
   </person>
</people>
EOF;
$sxe = simplexml_load_string($xml);
$sxe->attributes;
?>
# php5 sxe_leak.php 
/home/paj/cvs/builds/php5/ext/simplexml/simplexml.c(187) :  Freeing
0x408DE780 (16 bytes), script=sxe_leak.php=== Total 1 memory leaks
detected ===

$foo = $sxe->attributes; does not leak.

hth

pierre

---

## #7758 — Andi Gutmans — 2004-02-11T16:28:31+00:00

URL: https://externals.io/message/7696#7758 · In reply to: #7696

Fix being submitted as I type.
Thanks for the good reproducing script.

Andi

At 01:29 PM 2/10/2004 +0100, Pierre-Alain Joye wrote:
>Hello,
>
>Maybe this usage is wrong but it should not leak:
>
><?php
>$xml =<<<EOF
><people type="foo">
>    <person name="Joe">
>      Text1
>    </person>
></people>
>EOF;
>$sxe = simplexml_load_string($xml);
>$sxe->attributes;
>?>
># php5 sxe_leak.php
>/home/paj/cvs/builds/php5/ext/simplexml/simplexml.c(187) :  Freeing
>0x408DE780 (16 bytes), script=sxe_leak.php=== Total 1 memory leaks
>detected ===
>
>$foo = $sxe->attributes; does not leak.
>
>hth
>
>pierre
