Re: [xml] xmlAddChil and xmlFreeDoc

Sorry, xmlAddChild freed doc_module so I don't have to do xmlFreeDoc after xmlAddChild?

Antonio Meilán García escribió:
I have a question about xmlAddChild, here is the code:
    fd = open("FILE.xml", O_RDWR | O_CREAT );
    if (fd < 0)  perror("Error fd");

    doc=xmlReadFd(fd,  NULL, "UTF-8",0);
    if (doc==NULL) printf("doc==NULL\n");

    doc_module = xmlReadFile("OTHER_FILE.xml","UTF-8", 0);
    if (doc_module==NULL) printf("doc_module=NULL\n");

    root_module = xmlDocGetRootElement(doc_module);

    if (xmlAddChild(node,root_module)==NULL) printf("xmlAddChild problem\n");


    => In that point I get:
        *** glibc detected *** free(): invalid pointer: 0x0003ebb9 ***

If I don´t  locate xmlAddChild:
    root_module = xmlDocGetRootElement(doc_module);

there are not problem and xmlFreeDoc doesn't break the program,

What is the problem with xmlAddChild? How can I do the root_module child of root and obviously free doc_module pointer?

Thanks for your help,

_______________________________________________ xml mailing list, project page xml gnome org

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]