]> git.ipfire.org Git - thirdparty/libvirt.git/commit
admin: Use the newly introduced close callback handling helpers
authorErik Skultety <eskultet@redhat.com>
Thu, 10 Nov 2016 12:21:29 +0000 (13:21 +0100)
committerErik Skultety <eskultet@redhat.com>
Mon, 14 Nov 2016 09:18:56 +0000 (10:18 +0100)
commite555ed6f7b06c8dce6198b6f822f6b4e5fd478d5
treec2ed5af626bd3f386cf81a0757169e869ee3cd39
parent7cea74a3b2dee6a4b735d7877de47f0ecd86fb77
admin: Use the newly introduced close callback handling helpers

Use the newly introduced close callback helpers to make the code look just a
bit cleaner and more importantly, to fix the following memleak regarding a
dangling virAdmConnect object reference caused by assigning NULL to the close
callback data once the catch-disconnect routine used the callback followed
by a comparison of NULL to the originally defined close callback (which at that
moment had already been NULL'd by remoteAdminClientCloseFunc) in
virAdmConnectCloseCallbackUnregister.

717 (88 direct, 629 indirect) bytes in 1 blocks are definitely lost record
 110 of 141
    at 0x4C2A988: calloc (vg_replace_malloc.c:711)
    by 0x530696F: virAllocVar (viralloc.c:560)
    by 0x53689E6: virObjectNew (virobject.c:193)
    by 0x5368B5E: virObjectLockableNew (virobject.c:219)
    by 0x4E3E7EE: virAdmConnectNew (datatypes.c:900)
    by 0x4E398BB: virAdmConnectOpen (libvirt-admin.c:220)
    by 0x10D3E3: vshAdmConnect (virt-admin.c:161)
    by 0x10D624: vshAdmReconnect (virt-admin.c:215)
    by 0x10DB0A: cmdConnect (virt-admin.c:353)
    by 0x11288F: vshCommandRun (vsh.c:1313)
    by 0x10FDB6: main (virt-admin.c:1439)

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1357358

Signed-off-by: Erik Skultety <eskultet@redhat.com>
src/admin/admin_remote.c
src/datatypes.c
src/libvirt-admin.c