]> granicus.if.org Git - php/commitdiff
Fixed leaks on fatal errors in tidy.
authorIlia Alshanetsky <iliaa@php.net>
Sun, 23 May 2004 17:22:21 +0000 (17:22 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 23 May 2004 17:22:21 +0000 (17:22 +0000)
ext/tidy/tidy.c

index 770562d18f0f4626b0260160128ea29df3457893..3088af53bdf538a4b33959779f98f766db60bcb3 100644 (file)
@@ -403,6 +403,9 @@ static void php_tidy_quick_repair(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_fil
        tidyBufInit(errbuf);
        
        if (tidySetErrorBuffer(doc, errbuf) != 0) {
+               tidyBufFree(errbuf);
+               efree(errbuf);
+               tidyRelease(doc);
                php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not set Tidy error buffer");
        }
        
@@ -524,6 +527,11 @@ static void tidy_object_new(zend_class_entry *class_type, zend_object_handlers *
                        tidyBufInit(intern->ptdoc->errbuf);
 
                        if (tidySetErrorBuffer(intern->ptdoc->doc, intern->ptdoc->errbuf) != 0) {
+                               tidyBufFree(intern->ptdoc->errbuf);
+                               efree(intern->ptdoc->errbuf);
+                               tidyRelease(intern->ptdoc->doc);
+                               efree(intern->ptdoc);
+                               efree(intern);
                                php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not set Tidy error buffer");
                        }