Rather than VIR_ALLOC of the virDomainChrDefPtr
if (!def->consoles[0]) {
/* allocate a new console type for the stolen one */
- if (VIR_ALLOC(def->consoles[0]) < 0)
+ if (!(def->consoles[0] = virDomainChrDefNew(NULL)))
return -1;
/* Create an console alias for the serial port */
* or has a different type than SERIAL or NONE.
*/
virDomainChrDefPtr chr;
- if (VIR_ALLOC(chr) < 0)
+ if (!(chr = virDomainChrDefNew(NULL)))
return -1;
if (VIR_INSERT_ELEMENT(def->consoles,
return -1;
}
- if (VIR_ALLOC(*def) < 0)
+ if (!(*def = virDomainChrDefNew(NULL)))
return -1;
(*def)->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL;
return -1;
}
- if (VIR_ALLOC(*def) < 0)
+ if (!(*def = virDomainChrDefNew(NULL)))
return -1;
(*def)->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL;