Skip to content
Snippets Groups Projects
Commit c4f4e195 authored by Tuguoyi's avatar Tuguoyi Committed by Michal Privoznik
Browse files

qemu_conf: Fix double free problem for cfg->firmwares


cfg->firmwares still points to the original memory address after being
freed by virFirmwareFreeList(). As cfg get freed, it will be freed again
even if cfg->nfirmwares=0 which eventually lead to crash.

The patch fix it by setting cfg->firmwares to NULL explicitly after
virFirmwareFreeList() returns

Signed-off-by: default avatarGuoyi <Tu&lt;tu.guoyi@h3c.com>
Reviewed-by: default avatarJán Tomko <jtomko@redhat.com>
parent 0cbcd21b
Branches
Tags
No related merge requests found
......@@ -834,6 +834,7 @@ virQEMUDriverConfigLoadNVRAMEntry(virQEMUDriverConfigPtr cfg,
VIR_AUTOSTRINGLIST fwList = NULL;
virFirmwareFreeList(cfg->firmwares, cfg->nfirmwares);
cfg->firmwares = NULL;
if (qemuFirmwareFetchConfigs(&fwList, privileged) < 0)
return -1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment