From 2a33dc41bbadf5d37fe162f9e6b7759d2e824fbd Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A1n=20Tomko?= Date: Mon, 21 Jan 2019 14:48:18 +0100 Subject: [PATCH] virQEMUDriverConfigLoadNVRAMEntry: use VIR_AUTOFREE MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Switch the function to use VIR_AUTOFREE and VIR_AUTOPTR macros to get rid of the cleanup section. Requested-by: John Ferlan Signed-off-by: Ján Tomko Reviewed-by: Erik Skultety --- src/qemu/qemu_conf.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 1e2340b019..1d805993a9 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -829,31 +829,27 @@ static int virQEMUDriverConfigLoadNVRAMEntry(virQEMUDriverConfigPtr cfg, virConfPtr conf) { - char **nvram = NULL; - int ret = -1; + VIR_AUTOPTR(virString) nvram = NULL; size_t i; if (virConfGetValueStringList(conf, "nvram", false, &nvram) < 0) - goto cleanup; + return -1; if (nvram) { virFirmwareFreeList(cfg->firmwares, cfg->nfirmwares); cfg->nfirmwares = virStringListLength((const char *const *)nvram); if (nvram[0] && VIR_ALLOC_N(cfg->firmwares, cfg->nfirmwares) < 0) - goto cleanup; + return -1; for (i = 0; nvram[i] != NULL; i++) { if (VIR_ALLOC(cfg->firmwares[i]) < 0) - goto cleanup; + return -1; if (virFirmwareParse(nvram[i], cfg->firmwares[i]) < 0) - goto cleanup; + return -1; } } - ret = 0; - cleanup: - virStringListFree(nvram); - return ret; + return 0; } -- 2.39.5