diff options
-rw-r--r-- | src/modules/xml/xmlParser.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/modules/xml/xmlParser.cpp b/src/modules/xml/xmlParser.cpp index 1f5da4006b..67d65089c7 100644 --- a/src/modules/xml/xmlParser.cpp +++ b/src/modules/xml/xmlParser.cpp @@ -1317,7 +1317,10 @@ char XMLNode::maybeAddTxT(void *pa, XMLCSTR tokenPStr) n = xstrlen(d->pText[i]); size_t n2 = xstrlen(lpt)+1; d->pText[i] = (XMLSTR)realloc((void*)d->pText[i], (n+n2)*sizeof(XMLCHAR)); - if (!d->pText[i]) return 1; + if (!d->pText[i]) { + free(lpt); + return 1; + } memcpy((void*)(d->pText[i]+n), lpt, n2*sizeof(XMLCHAR)); free(lpt); return 0; |