[Expat-bugs] [ expat-Bugs-1513208 ] memory leak

SourceForge.net noreply at sourceforge.net
Sat Nov 25 18:45:28 CET 2006


Bugs item #1513208, was opened at 2006-06-27 05:21
Message generated for change (Comment added) made by kwaclaw
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=110127&aid=1513208&group_id=10127

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
>Resolution: Rejected
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: memory leak

Initial Comment:
version: 1.95.8

two bufferes, one is "<?xml version=\"1.0\" 
encoding=\"ISO-8859-1\" ?><ROOT><AcctNo>GL-002-
0012</AcctNo></ROOT>", another is "<ROOT><AcctNo>GL-
002-0012</AcctNo></ROOT>", the latter leak 80 bytes 
every time.

the difference of both bufferes is whether the PROLOG 
exists.

the tested function: XML_Parse.


----------------------------------------------------------------------

>Comment By: Karl Waclawek (kwaclaw)
Date: 2006-11-25 12:45

Message:
Logged In: YES 
user_id=290026
Originator: NO

Closing this issue - apparently there is no bug.

----------------------------------------------------------------------

Comment By: tracy (stratalight)
Date: 2006-10-11 16:17

Message:
Logged In: YES 
user_id=1618736

I think that the issue was with scew, not expat.  The tree
was not being deleted.

----------------------------------------------------------------------

Comment By: tracy (stratalight)
Date: 2006-10-11 14:11

Message:
Logged In: YES 
user_id=1618736

also - i was using expat 2.0 with scew 0.4.0

----------------------------------------------------------------------

Comment By: tracy (stratalight)
Date: 2006-10-11 14:11

Message:
Logged In: YES 
user_id=1618736

I am using scew on top of expat and valgrind also reports a leak
==23265== 112 (20 direct, 92 indirect) bytes in 1 blocks are
definitely lost in loss record 4 of 7
==23265==    at 0x4018B0F: calloc
(m_replacemalloc/vg_replace_malloc.c:279)
==23265==    by 0x80499A7: scew_tree_create (in
/home/tracy/test/x)
==23265==    by 0x8049041: xmldecl_handler (in
/home/tracy/test/x)
==23265==    by 0x40E5BC4: processXmlDecl (lib/xmlparse.c:3349)
==23265==    by 0x40E62FC: doProlog (lib/xmlparse.c:3713)
==23265==    by 0x40E623D: prologProcessor (lib/xmlparse.c:3616)
==23265==    by 0x40E33B8: XML_ParseBuffer (lib/xmlparse.c:1567)
==23265==    by 0x40E3328: XML_Parse (lib/xmlparse.c:1538)
==23265==    by 0x8048F58: scew_parser_load_buffer (in
/home/tracy/test/x)
==23265==    by 0x8048C3A: main (x.cpp:16)


the code looks like this

int main(int argc, char *argv[])
{
        char * data = {
                "<?xml version=\"1.0\"
encoding=\"ISO-8859-1\"?><X a=\"1\">xx</X
>"};
        scew_parser* parser = scew_parser_create();
        if (!parser) {
                return -1;
        }
        scew_parser_ignore_whitespaces(parser, 1);


        if (scew_parser_load_buffer(parser, data,
strlen(data))){
                std::cout << "OK\n";
        }
        else {
                std::cout << "Bad\n";
        }

        scew_parser_free(parser);
}

under the covers scew_parser does a XML_ParserCreate and
scew_parser_free does an XML_ParserFree.  scew_load_buffer
does a XML_Parse.  I found that there was no difference
between adding a prolog and not - 20 bytes were always lost.





----------------------------------------------------------------------

Comment By: Karl Waclawek (kwaclaw)
Date: 2006-07-05 09:18

Message:
Logged In: YES 
user_id=290026

Have you tested with CVS version?
How are you determining the leak?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=110127&aid=1513208&group_id=10127


More information about the Expat-bugs mailing list