Blame SOURCES/0003-Check-whether-the-index-variable-is-valid-before-der.patch

ad2f2b
From 05fd1b7d267d83ad73f67bb99aac5c9ba069d4e5 Mon Sep 17 00:00:00 2001
ad2f2b
From: Tomas Popela <tpopela@redhat.com>
ad2f2b
Date: Mon, 23 Jul 2018 10:09:43 +0200
ad2f2b
Subject: [PATCH 03/17] Check whether the index variable is valid before
ad2f2b
 dereferencing it
ad2f2b
ad2f2b
yelp-3.28.1/libyelp/yelp-docbook-document.c:1058: 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.
ad2f2b
yelp-3.28.1/libyelp/yelp-docbook-document.c:1026: deref_ptr: Directly dereferencing pointer "index".
ad2f2b
yelp-3.28.1/libyelp/yelp-docbook-document.c:1054: deref_ptr: Directly dereferencing pointer "index".
ad2f2b
 1052|       if (filename != NULL)
ad2f2b
 1053|           g_free (filename);
ad2f2b
 1054|->     if (index->doc != NULL)
ad2f2b
 1055|           xmlFreeDoc (index->doc);
ad2f2b
 1056|       if (index->doc_uri != NULL)
ad2f2b
---
ad2f2b
 libyelp/yelp-docbook-document.c | 11 ++++++-----
ad2f2b
 1 file changed, 6 insertions(+), 5 deletions(-)
ad2f2b
ad2f2b
diff --git a/libyelp/yelp-docbook-document.c b/libyelp/yelp-docbook-document.c
ad2f2b
index 24746248..afb49fb0 100644
ad2f2b
--- a/libyelp/yelp-docbook-document.c
ad2f2b
+++ b/libyelp/yelp-docbook-document.c
ad2f2b
@@ -1055,12 +1055,13 @@ docbook_index_threaded (YelpDocbookDocument *docbook)
ad2f2b
         g_object_unref (file);
ad2f2b
     if (filename != NULL)
ad2f2b
         g_free (filename);
ad2f2b
-    if (index->doc != NULL)
ad2f2b
-        xmlFreeDoc (index->doc);
ad2f2b
-    if (index->doc_uri != NULL)
ad2f2b
-        g_free (index->doc_uri);
ad2f2b
-    if (index != NULL)
ad2f2b
+    if (index != NULL) {
ad2f2b
+        if (index->doc != NULL)
ad2f2b
+            xmlFreeDoc (index->doc);
ad2f2b
+        if (index->doc_uri != NULL)
ad2f2b
+            g_free (index->doc_uri);
ad2f2b
         g_free (index);
ad2f2b
+    }
ad2f2b
     if (parserCtxt != NULL)
ad2f2b
         xmlFreeParserCtxt (parserCtxt);
ad2f2b
 
ad2f2b
-- 
ad2f2b
2.19.1
ad2f2b