libxml2 r3724 - trunk
- From: veillard svn gnome org
- To: svn-commits-list gnome org
- Subject: libxml2 r3724 - trunk
- Date: Thu, 3 Apr 2008 07:24:05 +0100 (BST)
Author: veillard
Date: Thu Apr 3 07:24:04 2008
New Revision: 3724
URL: http://svn.gnome.org/viewvc/libxml2?rev=3724&view=rev
Log:
* parser.c: more realloc problems pointed out by Ashwin
Daniel
Modified:
trunk/ChangeLog
trunk/parser.c
Modified: trunk/parser.c
==============================================================================
--- trunk/parser.c (original)
+++ trunk/parser.c Thu Apr 3 07:24:04 2008
@@ -1257,15 +1257,16 @@
return (-1);
}
} else if (ctxt->nsNr >= ctxt->nsMax) {
+ const xmlChar ** tmp;
ctxt->nsMax *= 2;
- ctxt->nsTab = (const xmlChar **)
- xmlRealloc((char *) ctxt->nsTab,
- ctxt->nsMax * sizeof(ctxt->nsTab[0]));
- if (ctxt->nsTab == NULL) {
+ tmp = (const xmlChar **) xmlRealloc((char *) ctxt->nsTab,
+ ctxt->nsMax * sizeof(ctxt->nsTab[0]));
+ if (tmp == NULL) {
xmlErrMemory(ctxt, NULL);
ctxt->nsMax /= 2;
return (-1);
}
+ ctxt->nsTab = tmp;
}
ctxt->nsTab[ctxt->nsNr++] = prefix;
ctxt->nsTab[ctxt->nsNr++] = URL;
@@ -1586,13 +1587,16 @@
static int spacePush(xmlParserCtxtPtr ctxt, int val) {
if (ctxt->spaceNr >= ctxt->spaceMax) {
+ int *tmp;
+
ctxt->spaceMax *= 2;
- ctxt->spaceTab = (int *) xmlRealloc(ctxt->spaceTab,
- ctxt->spaceMax * sizeof(ctxt->spaceTab[0]));
- if (ctxt->spaceTab == NULL) {
+ tmp = (int *) xmlRealloc(ctxt->spaceTab,
+ ctxt->spaceMax * sizeof(ctxt->spaceTab[0]));
+ if (tmp == NULL) {
xmlErrMemory(ctxt, NULL);
return(0);
}
+ ctxt->spaceTab = tmp;
}
ctxt->spaceTab[ctxt->spaceNr] = val;
ctxt->space = &ctxt->spaceTab[ctxt->spaceNr];
@@ -3325,7 +3329,6 @@
*/
if ((ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) &&
(ent->content != NULL)) {
- xmlChar *rep;
rep = xmlStringDecodeEntities(ctxt, ent->content,
XML_SUBSTITUTE_REF, 0, 0, 0);
if (rep != NULL) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]