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

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