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

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