qemu: Use virDomainChrSourceDefNew for monConfig

Rather than VIR_ALLOC, use the New function for allocation. We
already use the Free function anyway.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Laine Stump <laine@laine.org>
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
This commit is contained in:
John Ferlan 2018-04-06 11:49:01 -04:00
parent d6d8d7bb9a
commit 9e792d1aaa
6 changed files with 8 additions and 4 deletions

View File

@ -12211,7 +12211,7 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
} }
static virDomainChrSourceDefPtr virDomainChrSourceDefPtr
virDomainChrSourceDefNew(virDomainXMLOptionPtr xmlopt) virDomainChrSourceDefNew(virDomainXMLOptionPtr xmlopt)
{ {
virDomainChrSourceDefPtr def = NULL; virDomainChrSourceDefPtr def = NULL;

View File

@ -2827,6 +2827,9 @@ bool virDomainDefHasDeviceAddress(virDomainDefPtr def,
void virDomainDefFree(virDomainDefPtr vm); void virDomainDefFree(virDomainDefPtr vm);
virDomainChrSourceDefPtr
virDomainChrSourceDefNew(virDomainXMLOptionPtr xmlopt);
virDomainChrDefPtr virDomainChrDefNew(virDomainXMLOptionPtr xmlopt); virDomainChrDefPtr virDomainChrDefNew(virDomainXMLOptionPtr xmlopt);
virDomainDefPtr virDomainDefNew(void); virDomainDefPtr virDomainDefNew(void);

View File

@ -218,6 +218,7 @@ virDomainChrSourceDefClear;
virDomainChrSourceDefCopy; virDomainChrSourceDefCopy;
virDomainChrSourceDefFree; virDomainChrSourceDefFree;
virDomainChrSourceDefGetPath; virDomainChrSourceDefGetPath;
virDomainChrSourceDefNew;
virDomainChrSpicevmcTypeFromString; virDomainChrSpicevmcTypeFromString;
virDomainChrSpicevmcTypeToString; virDomainChrSpicevmcTypeToString;
virDomainChrTcpProtocolTypeFromString; virDomainChrTcpProtocolTypeFromString;

View File

@ -2422,7 +2422,7 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
xmlNodePtr node = NULL; xmlNodePtr node = NULL;
virQEMUCapsPtr qemuCaps = NULL; virQEMUCapsPtr qemuCaps = NULL;
if (VIR_ALLOC(priv->monConfig) < 0) if (!(priv->monConfig = virDomainChrSourceDefNew(NULL)))
goto error; goto error;
if (!(monitorpath = if (!(monitorpath =

View File

@ -2484,7 +2484,7 @@ qemuParseCommandLine(virCapsPtr caps,
if (monConfig) { if (monConfig) {
virDomainChrSourceDefPtr chr; virDomainChrSourceDefPtr chr;
if (VIR_ALLOC(chr) < 0) if (!(chr = virDomainChrSourceDefNew(NULL)))
goto error; goto error;
if (qemuParseCommandLineChr(chr, val) < 0) { if (qemuParseCommandLineChr(chr, val) < 0) {

View File

@ -5717,7 +5717,7 @@ qemuProcessPrepareDomain(virQEMUDriverPtr driver,
goto cleanup; goto cleanup;
} }
if (VIR_ALLOC(priv->monConfig) < 0) if (!(priv->monConfig = virDomainChrSourceDefNew(NULL)))
goto cleanup; goto cleanup;
VIR_DEBUG("Preparing monitor state"); VIR_DEBUG("Preparing monitor state");