Future patches rely on the ability to reset the contents of the virDomainVideoDef structure rather than re-allocating it. Signed-off-by: Erik Skultety <eskultet@xxxxxxxxxx> --- src/conf/domain_conf.c | 14 +++++++++++++- src/conf/domain_conf.h | 1 + src/libvirt_private.syms | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 70686ebd88..87dbb9a433 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2549,7 +2549,8 @@ virDomainVideoDefNew(void) } -void virDomainVideoDefFree(virDomainVideoDefPtr def) +void +virDomainVideoDefClear(virDomainVideoDefPtr def) { if (!def) return; @@ -2559,6 +2560,17 @@ void virDomainVideoDefFree(virDomainVideoDefPtr def) VIR_FREE(def->accel); VIR_FREE(def->virtio); VIR_FREE(def->driver); + + memset(def, 0, sizeof(*def)); +} + + +void virDomainVideoDefFree(virDomainVideoDefPtr def) +{ + if (!def) + return; + + virDomainVideoDefClear(def); VIR_FREE(def); } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index f31c78d5e6..834a7c1d7f 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2891,6 +2891,7 @@ void virDomainNVRAMDefFree(virDomainNVRAMDefPtr def); void virDomainWatchdogDefFree(virDomainWatchdogDefPtr def); virDomainVideoDefPtr virDomainVideoDefNew(void); void virDomainVideoDefFree(virDomainVideoDefPtr def); +void virDomainVideoDefClear(virDomainVideoDefPtr def); virDomainHostdevDefPtr virDomainHostdevDefNew(void); void virDomainHostdevDefClear(virDomainHostdevDefPtr def); void virDomainHostdevDefFree(virDomainHostdevDefPtr def); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 5499a368c0..5bd08d3f67 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -567,6 +567,7 @@ virDomainTPMModelTypeToString; virDomainUSBDeviceDefForeach; virDomainVideoDefaultRAM; virDomainVideoDefaultType; +virDomainVideoDefClear; virDomainVideoDefFree; virDomainVideoDefNew; virDomainVideoTypeFromString; -- 2.14.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list