On Wed, Aug 31, 2022 at 13:40:49 -0500, Jonathon Jongsma wrote: > Since the libvirt documentation suggests to prefer GObject over > virObject, and since virObject is a GObject, change virFileCache to > allow GObjects as data. > > Signed-off-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx> > --- > src/util/virfilecache.c | 15 +++++++++------ > src/util/virfilecache.h | 2 +- > 2 files changed, 10 insertions(+), 7 deletions(-) > > diff --git a/src/util/virfilecache.c b/src/util/virfilecache.c > index bad37c9f00..e37008990d 100644 > --- a/src/util/virfilecache.c > +++ b/src/util/virfilecache.c > @@ -170,7 +170,8 @@ virFileCacheLoad(virFileCache *cache, > *data = g_steal_pointer(&loadData); > > cleanup: > - virObjectUnref(loadData); > + if (loadData) > + g_object_unref(loadData); Please replace these with g_clear_pointer(&loadData, g_object_unref) to avoid the extra if .