diff --git a/src/conf/virinterfaceobj.c b/src/conf/virinterfaceobj.c index 1e3f25c04763cf107905a9f1765936c4c1255272..159fcb292cd477888739168579bec6980ab81706 100644 --- a/src/conf/virinterfaceobj.c +++ b/src/conf/virinterfaceobj.c @@ -47,7 +47,7 @@ struct _virInterfaceObjList { /* virInterfaceObj manipulation */ static virInterfaceObjPtr -virInterfaceObjNew(void) +virInterfaceObjNew(virInterfaceDefPtr def) { virInterfaceObjPtr obj; @@ -62,6 +62,7 @@ virInterfaceObjNew(void) } virInterfaceObjLock(obj); + obj->def = def; return obj; } @@ -251,17 +252,17 @@ virInterfaceObjListAssignDef(virInterfaceObjListPtr interfaces, return obj; } - if (!(obj = virInterfaceObjNew())) + if (!(obj = virInterfaceObjNew(def))) return NULL; if (VIR_APPEND_ELEMENT_COPY(interfaces->objs, interfaces->count, obj) < 0) { + obj->def = NULL; virInterfaceObjUnlock(obj); virInterfaceObjFree(obj); return NULL; } - obj->def = def; return obj; }