|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] xen-mapcache: Fix a build error with -fexceptions
When building with -Werror=maybe-uninitialized and -fexceptions, gcc can
report:
error: 'err' may be used uninitialized [-Werror=maybe-uninitialized]
err gets assigned to g_new0() unconditionally, but under -fexceptions
the calls to trace_xen_remap_bucket() or g_new0() might unwind, leading
the g_autofree cleanup to run g_free() on an uninitialised err. Avoid
the warning and any future issues by initialising it to NULL in the same
pattern as other definitions.
Signed-off-by: Alex Brett <alex.brett@xxxxxxxxxx>
---
hw/xen/xen-mapcache.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/xen/xen-mapcache.c b/hw/xen/xen-mapcache.c
index e30c07c2ee..0a19cfdc1b 100644
--- a/hw/xen/xen-mapcache.c
+++ b/hw/xen/xen-mapcache.c
@@ -199,7 +199,7 @@ static void xen_remap_bucket(MapCache *mc,
uint8_t *vaddr_base;
g_autofree uint32_t *refs = NULL;
g_autofree xen_pfn_t *pfns = NULL;
- g_autofree int *err;
+ g_autofree int *err = NULL;
unsigned int i;
hwaddr nb_pfn = size >> XC_PAGE_SHIFT;
--
2.53.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |