mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 07:17:44 +00:00
virQEMUDriverConfigLoadNVRAMEntry: use VIR_AUTOFREE
Switch the function to use VIR_AUTOFREE and VIR_AUTOPTR macros to get rid of the cleanup section. Requested-by: John Ferlan <jferlan@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
92e601d08c
commit
2a33dc41bb
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user