]> granicus.if.org Git - php/commitdiff
MFB: Added missing safety checks (Problem identified by Coverity scan)
authorIlia Alshanetsky <iliaa@php.net>
Sat, 7 Oct 2006 19:41:10 +0000 (19:41 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sat, 7 Oct 2006 19:41:10 +0000 (19:41 +0000)
ext/dom/document.c

index 4d05da87d8a650d5cc14d8f1de8a4c6666c296c7..8bebb417e0017fb9b3c62893c3ca181545231519 100644 (file)
@@ -1355,7 +1355,9 @@ PHP_METHOD(domdocument, __construct)
                        }
                }
                intern->document = NULL;
-               php_libxml_increment_doc_ref((php_libxml_node_object *)intern, docp TSRMLS_CC);
+               if (php_libxml_increment_doc_ref((php_libxml_node_object *)intern, docp TSRMLS_CC) == -1) {
+                       RETURN_FALSE;
+               }
                php_libxml_increment_node_ptr((php_libxml_node_object *)intern, (xmlNodePtr)docp, (void *)intern TSRMLS_CC);
        }
 }
@@ -1585,7 +1587,9 @@ static void dom_parse_document(INTERNAL_FUNCTION_PARAMETERS, int mode) {
                                }
                        }
                        intern->document = NULL;
-                       php_libxml_increment_doc_ref((php_libxml_node_object *)intern, newdoc TSRMLS_CC);
+                       if (php_libxml_increment_doc_ref((php_libxml_node_object *)intern, newdoc TSRMLS_CC) == -1) {
+                               RETURN_FALSE;
+                       }
                        intern->document->doc_props = doc_prop;
                }
 
@@ -2154,7 +2158,9 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode)
                                }
                        }
                        intern->document = NULL;
-                       php_libxml_increment_doc_ref((php_libxml_node_object *)intern, newdoc TSRMLS_CC);
+                       if (php_libxml_increment_doc_ref((php_libxml_node_object *)intern, newdoc TSRMLS_CC) == -1) {
+                               RETURN_FALSE;
+                       }
                        intern->document->doc_props = doc_prop;
                }