Some callers might want to clear the address but not the alias. Split the virDomainDeviceInfoClear() function to allow that. Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- src/conf/device_conf.c | 10 ++++++++-- src/conf/device_conf.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index d69f94fadf..8fa6bb4fe0 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c @@ -54,9 +54,8 @@ virDomainDeviceInfoCopy(virDomainDeviceInfoPtr dst, } 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); @@ -65,6 +64,13 @@ virDomainDeviceInfoClear(virDomainDeviceInfoPtr info) info->isolationGroupLocked = false; } +void +virDomainDeviceInfoClear(virDomainDeviceInfoPtr info) +{ + VIR_FREE(info->alias); + virDomainDeviceInfoClearAddress(info); +} + void virDomainDeviceInfoFree(virDomainDeviceInfoPtr info) { diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h index a31ce9c376..1d0e9e6925 100644 --- a/src/conf/device_conf.h +++ b/src/conf/device_conf.h @@ -179,6 +179,7 @@ struct _virDomainDeviceInfo { int virDomainDeviceInfoCopy(virDomainDeviceInfoPtr dst, virDomainDeviceInfoPtr src); +void virDomainDeviceInfoClearAddress(virDomainDeviceInfoPtr info); void virDomainDeviceInfoClear(virDomainDeviceInfoPtr info); void virDomainDeviceInfoFree(virDomainDeviceInfoPtr info); -- 2.16.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list