diff options
| author | Felipe Pena <felipe@php.net> | 2010-04-20 16:24:21 +0000 |
|---|---|---|
| committer | Felipe Pena <felipe@php.net> | 2010-04-20 16:24:21 +0000 |
| commit | 3a0a2af52c0d1145b546f77d9e869baaa2ce6844 (patch) | |
| tree | 0878e001626c1a20df0f66b34a0fd01c8fe97bd3 /ext/simplexml/simplexml.c | |
| parent | b7bd1167a958ac356b31db5acb469a81086a7b78 (diff) | |
| download | php-git-3a0a2af52c0d1145b546f77d9e869baaa2ce6844.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.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index 729e13106a..b071878190 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; } |
