From: Alberto Garcia Date: Mon, 12 Aug 2019 15:58:28 +0000 (+0300) Subject: main-loop: Fix GSource leak in qio_task_thread_worker() X-Git-Tag: v4.2.0-rc0~219^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b65cb867cc13b581baeea7648a9f45899cb7a714;p=thirdparty%2Fqemu.git main-loop: Fix GSource leak in qio_task_thread_worker() After g_source_attach() the GMainContext holds a reference to the GSource, so the caller does not need to keep it. qio_task_thread_worker() is not releasing its reference so the GSource is being leaked since a17536c594bfed94d05667b419f747b692f5fc7f. Signed-off-by: Alberto Garcia Reviewed-by: Daniel P. Berrangé Message-Id: <1565625509-404969-2-git-send-email-andrey.shinkevich@virtuozzo.com> Signed-off-by: Paolo Bonzini --- diff --git a/io/task.c b/io/task.c index 64c4c7126af..1ae7b864881 100644 --- a/io/task.c +++ b/io/task.c @@ -136,6 +136,7 @@ static gpointer qio_task_thread_worker(gpointer opaque) qio_task_thread_result, task, NULL); g_source_attach(task->thread->completion, task->thread->context); + g_source_unref(task->thread->completion); trace_qio_task_thread_source_attach(task, task->thread->completion); qemu_cond_signal(&task->thread_cond);