Blob Blame History Raw
From 9c87ed1f7a5daab0864b22be89ff58ffde51b5af Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
Date: Fri, 14 Jun 2019 17:11:16 +0200
Subject: [PATCH] udiskslinuxpartition: Fix potential NULL dereference

---
 src/udiskslinuxpartition.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/udiskslinuxpartition.c b/src/udiskslinuxpartition.c
index c29cf0fa..d00e6519 100644
--- a/src/udiskslinuxpartition.c
+++ b/src/udiskslinuxpartition.c
@@ -198,7 +198,7 @@ static void update_partitions_list (UDisksObject           *disk_object,
     /* this partition is already in the property */
     goto out;
 
-  num_parts = g_strv_length (partitions);
+  num_parts = partitions ? g_strv_length (partitions) : 0;
   partitions = g_realloc (partitions, (num_parts + 2) * sizeof (gchar *));
   partitions[num_parts] = g_strdup (object_path);
   partitions[num_parts + 1] = NULL;
-- 
2.21.0