]> granicus.if.org Git - php/commitdiff
fix #30780 (tidy segfaults on 'new tidyNode;')
authorAntony Dovgal <tony2001@php.net>
Sun, 14 Nov 2004 13:33:59 +0000 (13:33 +0000)
committerAntony Dovgal <tony2001@php.net>
Sun, 14 Nov 2004 13:33:59 +0000 (13:33 +0000)
ext/tidy/tidy.c

index 7a87300a7e93c73d109331bf1d2e3c59d4f3d6cf..ec0151e8cae3f0367b4caecdd7d9226aff837daf 100644 (file)
@@ -497,13 +497,15 @@ static void tidy_object_free_storage(void *object TSRMLS_DC)
        zend_hash_destroy(intern->std.properties);
        FREE_HASHTABLE(intern->std.properties);
 
-       intern->ptdoc->ref_count--;
-
-       if (intern->ptdoc->ref_count <= 0) {
-               tidyBufFree(intern->ptdoc->errbuf);
-               efree(intern->ptdoc->errbuf);
-               tidyRelease(intern->ptdoc->doc);
-               efree(intern->ptdoc);
+       if (intern->ptdoc) {
+               intern->ptdoc->ref_count--;
+
+               if (intern->ptdoc->ref_count <= 0) {
+                       tidyBufFree(intern->ptdoc->errbuf);
+                       efree(intern->ptdoc->errbuf);
+                       tidyRelease(intern->ptdoc->doc);
+                       efree(intern->ptdoc);
+               }
        }
 
        efree(object);