[libvirt] [libvirt-glib] a leak in libvirt-glib

Marc-André Lureau marcandre.lureau at gmail.com
Mon Feb 27 16:25:58 UTC 2012


In libvirt-glib, we call virStreamEventAddCallback() and give it a
ref, that is supposed to be unref when the stream event is removed. But
this doesn't happen! I tracked it down to:

static void remoteStreamCallbackFree(void *opaque)
    struct remoteStreamCallbackData *cbdata = opaque;

    if (!cbdata->cb && cbdata->ff)

Why are we checking for cbdata->cb here? That gives us a leak
when taking screenshots. So far I solved it
with the attached patch for libvirt-glib. I noticed it because that
of a resulting process & fd leakage in the libvirtd side.

It might be that the fix should be in libvirt, but anyway, the proposed
patch doesn't need a libvirt depedency update and also keeps the
object reference manangement at the libvirt-glib level, which is nice.

Marc-André Lureau
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Don-t-leak-GVirStream.patch
Type: text/x-patch
Size: 3452 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120227/cbbf487b/attachment-0001.bin>

More information about the libvir-list mailing list