On Tue, Mar 10, 2020 at 06:20:49PM +0100, Ján Tomko wrote: > On a Tuesday in 2020, Gaurav Agrawal wrote: > > --- > > src/qemu/qemu_domain.c | 36 ++++++++++++++++++++---------------- > > src/qemu/qemu_domain.h | 6 ++++-- > > src/qemu/qemu_process.c | 4 ++-- > > 3 files changed, 26 insertions(+), 20 deletions(-) > > > > [...] > > > @@ -10632,7 +10635,8 @@ qemuDomainLogContextPtr qemuDomainLogContextNew(virQEMUDriverPtr driver, > > return ctxt; > > > > error: > > - virObjectUnref(ctxt); > > + if (ctxt) > > + g_object_unref(ctxt); > > g_object_unref is safe to call with a NULL argument, the "if (ctxt)" > check is not needed here. I'm not so sure on that. g_clear_object API docs explicitly say that it is OK if the object is NULL: https://developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html#g-clear-object but the g_object_unref docs are completely silent on this matter: https://developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html#g-object-ref Thus I've always assumed a NULL check was required for g_object_unref Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|