]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
virNetSocketRemoveIOCallback: Be explicit about unref
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 18 Jun 2015 12:15:08 +0000 (14:15 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 19 Jun 2015 09:19:24 +0000 (11:19 +0200)
When going through the code I've notice that
virNetSocketAddIOCallback() increases the reference counter of
@socket. However, its counter part RemoveIOCallback does not. It took
me a while to realize this disproportion. The AddIOCallback registers
our own callback which eventually calls the desired callback and then
unref the @sock. Yeah, a bit complicated but it works. So, lets note
this hard learned fact in a comment in RemoveIOCallback().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/rpc/virnetsocket.c

index 2497f674ce1f15fdbf43cac76ebe07154b8aa746..48107ffad11893fd91d8649ceee538342ee62642 100644 (file)
@@ -1993,6 +1993,7 @@ void virNetSocketRemoveIOCallback(virNetSocketPtr sock)
     }
 
     virEventRemoveHandle(sock->watch);
+    /* Don't unref @sock, it's done via eventloop callback. */
 
     virObjectUnlock(sock);
 }