virsysinfo: Don't leak fw_cfg

In v6.4.0-72-g3dda889a44 I've introduced parsing and formatting
of new sysinfo type 'fwcfg'. However, I've forgot to introduce
code that would free parsed data.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
Michal Privoznik 2020-06-16 13:01:38 +02:00
parent 1b22dd6dd4
commit d659cd341f

View File

@ -131,6 +131,19 @@ void virSysinfoOEMStringsDefFree(virSysinfoOEMStringsDefPtr def)
VIR_FREE(def);
}
static void
virSysinfoFWCfgDefClear(virSysinfoFWCfgDefPtr def)
{
if (!def)
return;
VIR_FREE(def->name);
VIR_FREE(def->value);
VIR_FREE(def->file);
}
/**
* virSysinfoDefFree:
* @def: a sysinfo structure
@ -184,6 +197,10 @@ void virSysinfoDefFree(virSysinfoDefPtr def)
virSysinfoOEMStringsDefFree(def->oemStrings);
for (i = 0; i < def->nfw_cfgs; i++)
virSysinfoFWCfgDefClear(&def->fw_cfgs[i]);
VIR_FREE(def->fw_cfgs);
VIR_FREE(def);
}