Any struct embedding a virDomainDeviceInfo needs to initialize it by calling virDomainDeviceInfoClear(). Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx> --- src/conf/domain_conf.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 055fde9..fcb8465 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1397,6 +1397,8 @@ virDomainInputDefNew(void) if (VIR_ALLOC(def) < 0) return NULL; + virDomainDeviceInfoClear(&def->info); + return def; } @@ -1725,6 +1727,8 @@ virDomainDiskDefNew(virDomainXMLOptionPtr xmlopt) if (VIR_ALLOC(ret->src) < 0) goto error; + virDomainDeviceInfoClear(&ret->info); + if (xmlopt && xmlopt->privateData.diskNew && !(ret->privateData = xmlopt->privateData.diskNew())) @@ -1854,6 +1858,8 @@ virDomainControllerDefNew(virDomainControllerType type) if (VIR_ALLOC(def) < 0) return NULL; + virDomainDeviceInfoClear(&def->info); + def->type = type; /* initialize anything that has a non-0 default */ @@ -1910,6 +1916,8 @@ virDomainFSDefNew(void) if (VIR_ALLOC(ret->src) < 0) goto cleanup; + virDomainDeviceInfoClear(&ret->info); + return ret; cleanup: @@ -2040,6 +2048,8 @@ virDomainNetDefNew(void) if (VIR_ALLOC(def) < 0) return NULL; + virDomainDeviceInfoClear(&def->info); + return def; } @@ -2278,6 +2288,8 @@ virDomainSmartcardDefNew(void) if (VIR_ALLOC(def) < 0) return NULL; + virDomainDeviceInfoClear(&def->info); + return def; } @@ -2326,6 +2338,8 @@ virDomainSoundDefNew(void) if (VIR_ALLOC(def) < 0) return NULL; + virDomainDeviceInfoClear(&def->info); + return def; } @@ -2352,6 +2366,8 @@ virDomainMemballoonDefNew(void) if (VIR_ALLOC(def) < 0) return NULL; + virDomainDeviceInfoClear(&def->info); + return def; } @@ -2374,6 +2390,8 @@ virDomainNVRAMDefNew(void) if (VIR_ALLOC(def) < 0) return NULL; + virDomainDeviceInfoClear(&def->info); + return def; } @@ -2395,6 +2413,8 @@ virDomainWatchdogDefNew(void) if (VIR_ALLOC(def) < 0) return NULL; + virDomainDeviceInfoClear(&def->info); + return def; } @@ -2416,6 +2436,8 @@ virDomainRNGDefNew(void) if (VIR_ALLOC(def) < 0) return NULL; + virDomainDeviceInfoClear(&def->info); + return def; } @@ -2449,6 +2471,8 @@ virDomainShmemDefNew(void) if (VIR_ALLOC(def) < 0) return NULL; + virDomainDeviceInfoClear(&def->info); + return def; } @@ -2471,6 +2495,8 @@ virDomainVideoDefNew(void) if (VIR_ALLOC(def) < 0) return NULL; + virDomainDeviceInfoClear(&def->info); + return def; } @@ -2499,6 +2525,8 @@ virDomainHostdevDefNew(virDomainXMLOptionPtr xmlopt) if (!(def->info = virDomainDeviceInfoNew())) goto error; + virDomainDeviceInfoClear(def->info); + if (xmlopt && xmlopt->privateData.hostdevNew && !(def->privateData = xmlopt->privateData.hostdevNew())) @@ -2597,6 +2625,8 @@ virDomainTPMDefNew(void) if (VIR_ALLOC(def) < 0) return NULL; + virDomainDeviceInfoClear(&def->info); + return def; } @@ -2640,6 +2670,8 @@ virDomainHubDefNew(void) if (VIR_ALLOC(def) < 0) return NULL; + virDomainDeviceInfoClear(&def->info); + return def; } @@ -2660,6 +2692,8 @@ virDomainRedirdevDefNew(void) if (VIR_ALLOC(def) < 0) return NULL; + virDomainDeviceInfoClear(&def->info); + return def; } @@ -2696,6 +2730,8 @@ virDomainMemoryDefNew(void) if (VIR_ALLOC(def) < 0) return NULL; + virDomainDeviceInfoClear(&def->info); + return def; } @@ -2917,6 +2953,8 @@ virDomainPanicDefNew(void) if (VIR_ALLOC(def) < 0) return NULL; + virDomainDeviceInfoClear(&def->info); + return def; } @@ -11229,6 +11267,8 @@ virDomainChrDefNew(virDomainXMLOptionPtr xmlopt) if (VIR_ALLOC(def) < 0) return NULL; + virDomainDeviceInfoClear(&def->info); + def->target.port = -1; if (!(def->source = virDomainChrSourceDefNew(xmlopt))) -- 2.7.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list