[yelp] Check whether the index variable is valid before dereferencing it



commit 9252d10b415c62147f20bdedff82318dd303c73e
Author: Tomas Popela <tpopela redhat com>
Date:   Mon Jul 23 11:04:35 2018 +0200

    Check whether the index variable is valid before dereferencing it
    
    yelp-3.28.1/libyelp/yelp-mallard-document.c:1002: deref_ptr: Directly dereferencing pointer "index".
    yelp-3.28.1/libyelp/yelp-mallard-document.c:1073: check_after_deref: Null-checking "index" suggests that 
it may be null, but it has already been dereferenced on all paths leading to the check.

 libyelp/yelp-mallard-document.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
---
diff --git a/libyelp/yelp-mallard-document.c b/libyelp/yelp-mallard-document.c
index b72dc9a5..1302a116 100644
--- a/libyelp/yelp-mallard-document.c
+++ b/libyelp/yelp-mallard-document.c
@@ -1099,8 +1099,7 @@ mallard_index_threaded (YelpMallardDocument *mallard)
                 xmlXPathFreeContext (xpath);
             if (index->doc != NULL)
                 xmlFreeDoc (index->doc);
-            if (index != NULL)
-                g_free (index);
+            g_free (index);
             if (parserCtxt != NULL)
                 xmlFreeParserCtxt (parserCtxt);
             g_object_unref (pagefile);


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