[xml] xmlDocDumpMemory problem under Windows



Hello,


The following program runs well under Linux, but SEGV at free() under
Windows. After some debug, no clue is found.

#include <stdlib.h>
#include <libxml/tree.h>

main()
{
    xmlDocPtr doc;
    xmlNodePtr tree, subtree;
    xmlChar *buffer;
    int size;

    doc = xmlNewDoc("1.0");
    doc->children = xmlNewDocNode(doc, NULL, "spy", NULL);
    xmlSetProp(doc->children, "version", "1.0");
    tree = xmlNewChild(doc->children, NULL, "targetlist", NULL);
    xmlSetProp(tree, "action", "add");
    subtree = xmlNewChild(tree, NULL, "target", "210.82.190.9");
    xmlSetProp(subtree, "type", "host");
    subtree = xmlNewChild(tree, NULL, "target", "210.82.190.10");
    xmlSetProp(subtree, "type", "host");
    subtree = xmlNewChild(tree, NULL, "target", "210.82.190.11");
    xmlSetProp(subtree, "type", "host");

    xmlDocDumpMemory(doc, &buffer, &size);
    printf("size is %d\n--%s--\n", size, buffer);
    free(buffer);
}


-- 
  lark






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