[libvirt] [PATCH] dbus: Don't unref NULL messages

Daniel P. Berrange berrange at redhat.com
Thu Feb 11 10:27:58 UTC 2016


On Thu, Feb 11, 2016 at 11:25:05AM +0100, Michal Privoznik wrote:
> Apparently we are not the only ones with dumb free functions
> because dbus_message_unref() does not accept NULL either. But if
> I were to vote, this one is even more evil. Instead of returning
> an error just like we do it immediately dereference any pointer
> passed and thus crash you app. Well done DBus!
> 
>   Program received signal SIGSEGV, Segmentation fault.
>   [Switching to Thread 0x7f878ebda700 (LWP 31264)]
>   0x00007f87be4016e5 in ?? () from /usr/lib64/libdbus-1.so.3
>   (gdb) bt
>   #0  0x00007f87be4016e5 in ?? () from /usr/lib64/libdbus-1.so.3
>   #1  0x00007f87be3f004e in dbus_message_unref () from /usr/lib64/libdbus-1.so.3
>   #2  0x00007f87bf6ecf95 in virSystemdGetMachineNameByPID (pid=9849) at util/virsystemd.c:228
>   #3  0x00007f879761bd4d in qemuConnectCgroup (driver=0x7f87600a32a0, vm=0x7f87600c7550) at qemu/qemu_cgroup.c:909
>   #4  0x00007f87976386b7 in qemuProcessReconnect (opaque=0x7f87600db840) at qemu/qemu_process.c:3386
>   #5  0x00007f87bf6edfff in virThreadHelper (data=0x7f87600d5580) at util/virthread.c:206
>   #6  0x00007f87bb602334 in start_thread (arg=0x7f878ebda700) at pthread_create.c:333
>   #7  0x00007f87bb3481bd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
>   (gdb) frame 2
>   #2  0x00007f87bf6ecf95 in virSystemdGetMachineNameByPID (pid=9849) at util/virsystemd.c:228
>   228         dbus_message_unref(reply);
>   (gdb) p reply
>   $1 = (DBusMessage *) 0x0
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>

ACK


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list