summaryrefslogtreecommitdiff
path: root/ext/simplexml/simplexml.c
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2010-04-20 16:24:21 +0000
committerFelipe Pena <felipe@php.net>2010-04-20 16:24:21 +0000
commitdf43d76e62638ab7b1014100da8a670d6872bc61 (patch)
tree99fccba724fea7a3675598dffb80f860b2dce2ed /ext/simplexml/simplexml.c
parent1efc049863c5d2c3eb06fe139f465819663d7260 (diff)
downloadphp-git-df43d76e62638ab7b1014100da8a670d6872bc61.tar.gz
- Fixed bug #51615 (PHP crash with wrong HTML in SimpleXML)
Diffstat (limited to 'ext/simplexml/simplexml.c')
-rw-r--r--ext/simplexml/simplexml.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index f1843b497f..3f41fc8357 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -988,9 +988,14 @@ static void sxe_dimension_delete(zval *object, zval *offset TSRMLS_DC)
static inline char * sxe_xmlNodeListGetString(xmlDocPtr doc, xmlNodePtr list, int inLine) /* {{{ */
{
xmlChar *tmp = xmlNodeListGetString(doc, list, inLine);
- char *res = estrdup((char*)tmp);
-
- xmlFree(tmp);
+ char *res;
+
+ if (tmp) {
+ res = estrdup((char*)tmp);
+ xmlFree(tmp);
+ } else {
+ res = STR_EMPTY_ALLOC();
+ }
return res;
}