Received: from eggs.gnu.org ([2001:4830:134:3::10]:52130) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNKBU-0001os-HL for qemu-devel@nongnu.org; Wed, 13 Jul 2016 09:26:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bNKBT-00039V-8m for qemu-devel@nongnu.org; Wed, 13 Jul 2016 09:26:40 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:35886) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNKBT-00039Q-1w for qemu-devel@nongnu.org; Wed, 13 Jul 2016 09:26:39 -0400 Received: by mail-wm0-x242.google.com with SMTP id x83so5864778wma.3 for ; Wed, 13 Jul 2016 06:26:38 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Wed, 13 Jul 2016 15:26:22 +0200 Message-Id: <1468416392-120170-5-git-send-email-pbonzini@redhat.com> In-Reply-To: <1468416392-120170-1-git-send-email-pbonzini@redhat.com> References: <1468416392-120170-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 04/14] main-loop: check return value before using pointer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Cao jin From: Cao jin pointer 'qemu_aio_context' should be checked first before it is used. qemu_bh_new() will use it. Signed-off-by: Cao jin Message-Id: <1467799740-26079-2-git-send-email-caoj.fnst@cn.fujitsu.com> Signed-off-by: Paolo Bonzini --- main-loop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main-loop.c b/main-loop.c index 89a6994..6a7f8d3 100644 --- a/main-loop.c +++ b/main-loop.c @@ -154,11 +154,11 @@ int qemu_init_main_loop(Error **errp) } qemu_aio_context = aio_context_new(&local_error); - qemu_notify_bh = qemu_bh_new(notify_event_cb, NULL); if (!qemu_aio_context) { error_propagate(errp, local_error); return -EMFILE; } + qemu_notify_bh = qemu_bh_new(notify_event_cb, NULL); gpollfds = g_array_new(FALSE, FALSE, sizeof(GPollFD)); src = aio_get_g_source(qemu_aio_context); g_source_attach(src, NULL); -- 1.8.3.1