]> granicus.if.org Git - php/commitdiff
simon says leaking is better than crashing
authorSterling Hughes <sterling@php.net>
Mon, 9 Jun 2003 03:29:33 +0000 (03:29 +0000)
committerSterling Hughes <sterling@php.net>
Mon, 9 Jun 2003 03:29:33 +0000 (03:29 +0000)
ext/simplexml/simplexml.c

index 365109e6c40345f885cfe775b2b11d7ab695f471..7eb522d7859d9d69d670bcfe2cfd7a8fff9c3d8e 100644 (file)
@@ -783,12 +783,13 @@ sxe_object_dtor(void *object, zend_object_handle handle TSRMLS_DC)
 
        sxe = (php_sxe_object *) object;
 
-       FREE_HASHTABLE(sxe->zo.properties);
-
-       if (--sxe->document->refcount <= 0) {
-               xmlFreeDoc(sxe->document->ptr);
+       if (--sxe->document->refcount > 0) {
+               return;
        }
        
+       xmlFreeDoc(sxe->document->ptr);
+       FREE_HASHTABLE(sxe->zo.properties);
+
        if (sxe->xpath) {
                xmlXPathFreeContext(sxe->xpath);
        }