On Tue, 2020-04-21 at 15:48 +0200, Rafael Fonseca wrote: > @@ -793,21 +830,13 @@ virResctrlGetInfo(virResctrlInfoPtr resctrl) > virResctrlInfoPtr > virResctrlInfoNew(void) > { > - virResctrlInfoPtr ret = NULL; > - > - if (virResctrlInitialize() < 0) > - return NULL; > - > - ret = virObjectNew(virResctrlInfoClass); > - if (!ret) > - return NULL; > + g_autoptr(virResctrlInfo) ret = > VIR_RESCTRL_INFO(g_object_new(VIR_TYPE_RESCTRL_INFO, NULL)); > > if (virResctrlGetInfo(ret) < 0) { > - virObjectUnref(ret); > return NULL; > } > > - return ret; > + return g_steal_pointer(&ret); > } (FYI: Glib provides a base class GInitiable (and an async variant) for an object that requires initialization immediately after allocation and returns NULL if said initialization fails. Not sure that it would gain us anything here, but just thought I'd mention it.) Jonathon