Blob Blame History Raw
From ee9f80190d4c458a09309fbd9a88d2756dc2d3fa Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Mon, 10 Feb 2020 20:13:13 +0100
Subject: [PATCH] Fix maybe-uninitialized warning

GCC gives the following compile warning:

grubby.c: In function 'suseGrubConfGetBoot':
grubby.c:2770:5: error: 'grubDevice' may be used uninitialized in this function [-Werror=maybe-uninitialized]
 2770 |     free(grubDevice);
      |     ^~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [Makefile:38: grubby.o] Error 1

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
 grubby.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grubby.c b/grubby.c
index 0c0f67a0ae5..779c25a2bf9 100644
--- a/grubby.c
+++ b/grubby.c
@@ -2755,7 +2755,7 @@ int grubGetBootFromDeviceMap(const char * device,
 }
 
 int suseGrubConfGetBoot(const char * path, char ** bootPtr) {
-    char * grubDevice;
+    char * grubDevice = NULL;
 
     if (suseGrubConfGetInstallDevice(path, &grubDevice))
 	dbgPrintf("error looking for grub installation device\n");
-- 
2.24.1