[libxml++] Document: Avoid possible null pointer dereference



commit 6a4bf61a602758364bd1cc79a00afabe4b510d27
Author: Gaurav <g gupta samsung com>
Date:   Fri Jul 4 20:04:37 2014 +0200

    Document: Avoid possible null pointer dereference
    
    * libxml++/document.cc: In create_root_node() check that 'element' is
    non-null before it's used. Bug #732604.

 libxml++/document.cc |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/libxml++/document.cc b/libxml++/document.cc
index 6bc3112..90ffeea 100644
--- a/libxml++/document.cc
+++ b/libxml++/document.cc
@@ -253,7 +253,7 @@ Element* Document::create_root_node(const Glib::ustring& name,
 
   Element* element = get_root_node();
 
-  if( !ns_uri.empty() )
+  if( !ns_uri.empty() && element )
   {
     element->set_namespace_declaration(ns_uri, ns_prefix);
     element->set_namespace(ns_prefix);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]