]> git.proxmox.com Git - mirror_qemu.git/commitdiff
io: remove mistaken call to object_ref on QTask
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 7 Jun 2016 11:27:51 +0000 (12:27 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Wed, 3 Aug 2016 09:28:50 +0000 (10:28 +0100)
The QTask struct is just a standalone struct, not a QOM Object,
so calling object_ref() on it is not appropriate. This results
in mangling the 'destroy' field in the QTask struct, causing
the later call to qtask_free() to try to call the function
at address 0x1, with predictably segfault happy results.

There is in fact no need for ref counting with QTask, as the
call to qtask_abort() or qtask_complete() will automatically
free associated memory.

This fixes the crash shown in

  https://bugs.launchpad.net/qemu/+bug/1589923

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
io/channel-websock.c

index 239c75a9794ae5c7fc380ed4600bee2c1a001d6e..533bd4b3b59263412253eb47715289b3f20e8006 100644 (file)
@@ -317,14 +317,13 @@ static gboolean qio_channel_websock_handshake_io(QIOChannel *ioc,
         return TRUE;
     }
 
-    object_ref(OBJECT(task));
     trace_qio_channel_websock_handshake_reply(ioc);
     qio_channel_add_watch(
         wioc->master,
         G_IO_OUT,
         qio_channel_websock_handshake_send,
         task,
-        (GDestroyNotify)object_unref);
+        NULL);
     return FALSE;
 }