|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11353 Memory leak in php_domxml.c, domxml_dumpmem
Submitted: 2001-06-08 06:28 UTC Modified: 2001-12-13 06:25 UTC
From: tgagne at efinnet dot com Assigned:
Status: Closed Package: DOM XML related
PHP Version: 4.0.5 OS: RHat 6.2
Private report: No CVE-ID: None
 [2001-06-08 06:28 UTC] tgagne at efinnet dot com
The memory allocated by xmlDumpMemory must be deallocated (free()'d).  The Zend/zend_API.h macro RETURN_STRINGL() doesn't do this.  A substitute (below) seems to do the trick.

#define FREE_RETURN_STRINGL(s,l,duplicate) {        \
        char *__s=(s); int __l=l;           \
        return_value->value.str.len = __l;  \
        return_value->value.str.val = (duplicate?estrndup(__s,__l):__s);    \
        return_value->type = IS_STRING;     \
        free(s);                            \
        return;                             \

I used this at the bottom of domxml_dumpmem() and can now do bunches of dom functions without crashing Apache or the CGI.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-21 20:05 UTC]
Can't reproduce this with latest RC.

Can you try latest RC and see if the problem still exists


 [2001-12-13 06:25 UTC]
No feedback. Closing.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 15 11:01:29 2024 UTC