• M
    dbus: Don't unref NULL messages · 862298a2
    Michal Privoznik 提交于
    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: NMichal Privoznik <mprivozn@redhat.com>
    862298a2
virpolkittest.c 9.4 KB