grubby/backport-Fix-maybe-uninitialized-warning.patch
2021-07-30 14:54:29 +08:00

36 lines
1.1 KiB
Diff

From 99d10a31cee89eb45ac0743f484018d36500ce66 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Mon, 10 Feb 2020 20:08:42 +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 5de935d..74befea 100644
--- a/grubby.c
+++ b/grubby.c
@@ -2896,7 +2896,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");
--
1.8.3.1