1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-10 08:58:16 +03:00

remove a couple of leaks on errors reported by Jinmei Tatuya daniel

* xmlwriter.c: remove a couple of leaks on errors reported by
  Jinmei Tatuya
daniel

svn path=/trunk/; revision=3816
This commit is contained in:
Daniel Veillard 2009-02-20 08:19:53 +00:00
parent 97ff9b367a
commit eb0a0b2e31
2 changed files with 13 additions and 5 deletions

View File

@ -1,3 +1,8 @@
Fri Feb 20 09:18:56 CET 2009 Daniel Veillard <daniel@veillard.com>
* xmlwriter.c: remove a couple of leaks on errors reported by
Jinmei Tatuya
Sun Jan 18 22:37:59 CET 2009 Daniel Veillard <daniel@veillard.com>
* configure.in doc/xml.html doc/*: preparing 0.7.3 release

View File

@ -370,7 +370,7 @@ xmlNewTextWriterDoc(xmlDocPtr * doc, int compression)
ctxt = xmlCreatePushParserCtxt(&saxHandler, NULL, NULL, 0, NULL);
if (ctxt == NULL) {
xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR,
"xmlNewTextWriterDoc : error at xmlCreatePushParserCtxt!\n");
"xmlNewTextWriterDoc : error at xmlCreatePushParserCtxt!\n");
return NULL;
}
/*
@ -389,8 +389,10 @@ xmlNewTextWriterDoc(xmlDocPtr * doc, int compression)
ret = xmlNewTextWriterPushParser(ctxt, compression);
if (ret == NULL) {
xmlFreeDoc(ctxt->myDoc);
xmlFreeParserCtxt(ctxt);
xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR,
"xmlNewTextWriterDoc : error at xmlNewTextWriterPushParser!\n");
"xmlNewTextWriterDoc : error at xmlNewTextWriterPushParser!\n");
return NULL;
}
@ -1510,12 +1512,13 @@ xmlTextWriterWriteString(xmlTextWriterPtr writer, const xmlChar * content)
if (buf != NULL) {
count = xmlTextWriterWriteRaw(writer, buf);
if (count < 0)
return -1;
sum += count;
if (buf != content) /* buf was allocated by us, so free it */
xmlFree(buf);
if (count < 0)
return -1;
sum += count;
}
return sum;