[libvirt] [PATCH v2 1/2] device_conf: Split virDomainDeviceInfoClear
Andrea Bolognani
abologna at redhat.com
Tue Aug 21 11:15:04 UTC 2018
On Tue, 2018-08-21 at 12:12 +0200, Michal Privoznik wrote:
> void
> -virDomainDeviceInfoClear(virDomainDeviceInfoPtr info)
> +virDomainDeviceInfoClearAddress(virDomainDeviceInfoPtr info)
> {
> - VIR_FREE(info->alias);
> memset(&info->addr, 0, sizeof(info->addr));
> info->type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE;
> VIR_FREE(info->romfile);
Now virDomainDeviceInfoClearAddress() clears out *way more* than
just the address, including romfile and other information not
visible in the context... It should really only call memset and
reset info->type in order for the name not to be very misleading.
[...]
> +void
> +virDomainDeviceInfoClear(virDomainDeviceInfoPtr info)
> +{
> + VIR_FREE(info->alias);
> + virDomainDeviceInfoClearAddress(info);
> +}
romfile and friends should be cleared out here along with the alias
and, of course, the address :)
With that fixed
Reviewed-by: Andrea Bolognani <abologna at redhat.com>
--
Andrea Bolognani / Red Hat / Virtualization
More information about the libvir-list
mailing list