conf: Use virDomainChrSourceDefNew for vhostuser

Rather than using VIR_ALLOC, use the New API since we already
use the virDomainChrSourceDefFree function when done.

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:47:33 -04:00
parent 5f723b74ed
commit d6d8d7bb9a

View File

@ -11138,7 +11138,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
goto error;
}
if (VIR_ALLOC(def->data.vhostuser) < 0)
if (!(def->data.vhostuser = virDomainChrSourceDefNew(xmlopt)))
goto error;
def->data.vhostuser->type = VIR_DOMAIN_CHR_TYPE_UNIX;