diff --git a/src/conf/virnetworkportdef.c
b/src/conf/virnetworkportdef.c
index 1db3dc69e2..3183078195 100644
--- a/src/conf/virnetworkportdef.c
+++ b/src/conf/virnetworkportdef.c
@@ -95,8 +95,8 @@ virNetworkPortDefParseXML(xmlXPathContextPtr ctxt)
g_autofree char *managed = NULL;
g_autofree char *driver = NULL;
- if (VIR_ALLOC(def) < 0)
- return NULL;
+ def = g_new0(virNetworkPortDef,
+ 1);
Make ^these a single line.