From: Peter Krempa Date: Thu, 20 Dec 2012 12:41:32 +0000 (+0100) Subject: conf: Use correct type for device type enum in virDomainDeviceDefFree X-Git-Tag: v1.0.3-rc1~236 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a3cf528e52431a257eaaf15aab6f0839c7c026b;p=thirdparty%2Flibvirt.git conf: Use correct type for device type enum in virDomainDeviceDefFree With this change it's easy to spot a forgotten free if a new device class is added. --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index abf2b6bcd9..de54c2c02e 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1524,7 +1524,7 @@ void virDomainDeviceDefFree(virDomainDeviceDefPtr def) if (!def) return; - switch (def->type) { + switch ((virDomainDeviceType) def->type) { case VIR_DOMAIN_DEVICE_DISK: virDomainDiskDefFree(def->data.disk); break; @@ -1561,6 +1561,13 @@ void virDomainDeviceDefFree(virDomainDeviceDefPtr def) case VIR_DOMAIN_DEVICE_REDIRDEV: virDomainRedirdevDefFree(def->data.redirdev); break; + case VIR_DOMAIN_DEVICE_NONE: + case VIR_DOMAIN_DEVICE_FS: + case VIR_DOMAIN_DEVICE_SMARTCARD: + case VIR_DOMAIN_DEVICE_CHR: + case VIR_DOMAIN_DEVICE_MEMBALLOON: + case VIR_DOMAIN_DEVICE_LAST: + break; } VIR_FREE(def);