Blame SOURCES/0001-Fix-a-few-Dereference-of-null-pointer-warnings.patch

7703fd
From 411ce03bdeddd7cbf69cb7c68845c99908657bf9 Mon Sep 17 00:00:00 2001
7703fd
From: Richard Hughes <richard@hughsie.com>
7703fd
Date: Wed, 1 Mar 2017 16:39:27 +0000
7703fd
Subject: [PATCH 1/4] Fix a few 'Dereference of null pointer' warnings
7703fd
7703fd
---
7703fd
 libgcab/cabinet.c      | 2 +-
7703fd
 libgcab/gcab-cabinet.c | 2 +-
7703fd
 libgcab/gcab-folder.c  | 2 +-
7703fd
 3 files changed, 3 insertions(+), 3 deletions(-)
7703fd
7703fd
diff --git a/libgcab/cabinet.c b/libgcab/cabinet.c
7703fd
index 1fa2af8..4df9024 100644
7703fd
--- a/libgcab/cabinet.c
7703fd
+++ b/libgcab/cabinet.c
7703fd
@@ -562,7 +562,7 @@ end:
7703fd
         g_set_error (error, GCAB_ERROR, GCAB_ERROR_FAILED,
7703fd
                      "zlib failed: %s", zError (zret));
7703fd
 
7703fd
-    if (!*error && !success)
7703fd
+    if (error != NULL && *error == NULL && !success)
7703fd
         g_set_error (error, GCAB_ERROR, GCAB_ERROR_FAILED,
7703fd
                      "Invalid cabinet chunk");
7703fd
 
7703fd
diff --git a/libgcab/gcab-cabinet.c b/libgcab/gcab-cabinet.c
7703fd
index e81b052..a6cc4f0 100644
7703fd
--- a/libgcab/gcab-cabinet.c
7703fd
+++ b/libgcab/gcab-cabinet.c
7703fd
@@ -257,7 +257,7 @@ gcab_cabinet_write (GCabCabinet *self,
7703fd
 
7703fd
         g_clear_object (&in);
7703fd
         in = G_INPUT_STREAM (g_file_read (file->file, cancellable, error));
7703fd
-        if (*error)
7703fd
+        if (in == NULL)
7703fd
             goto end;
7703fd
 
7703fd
         while ((len = g_input_stream_read (in,
7703fd
diff --git a/libgcab/gcab-folder.c b/libgcab/gcab-folder.c
7703fd
index e724097..dc33b6a 100644
7703fd
--- a/libgcab/gcab-folder.c
7703fd
+++ b/libgcab/gcab-folder.c
7703fd
@@ -240,7 +240,7 @@ gcab_folder_add_file (GCabFolder *self, GCabFile *file,
7703fd
         g_return_val_if_fail (G_IS_FILE (gfile), FALSE);
7703fd
 
7703fd
         GFileInfo *info = g_file_query_info (gfile, FILE_ATTRS, 0, NULL, error);
7703fd
-        if (*error)
7703fd
+        if (info == NULL)
7703fd
             return FALSE;
7703fd
 
7703fd
         success = add_file_info (self, file, info,
7703fd
-- 
7703fd
2.9.3
7703fd