From nobody Fri Apr 19 23:26:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585162280; cv=none; d=zohomail.com; s=zohoarc; b=bDZoAbY0Ih/DBqiEunhJrEt068AXXRUhWuuto/3Y9SQAK3asKw5KnuRv7nv9SSDXcx93Qd/4e7DTCxqi4bdTp3uqo0KddWjRWbzG84peTY+/ZaMO7sm1IBIjbhwt0huBsCu/P4rk0QxxO7UEyUXXsnc4qAwTMx7LrkYlVvRLVrI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585162280; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=z41bJn5B0sKkbJNUSwdEnkMO1h3qMJLWpIO+ZqC84os=; b=bqJ0jEGcvC7tZeZR7g25cPOO53N7Lw5oSBojeeMdyexlOZ0mTYMDxvwjywrwu9BjMy8c9+UqcXEP9QthUYziQ8HBKa75fV22qj/uI3dtExO0GYijL0AbWANLfJhlJAIrtgpZ5hnIfU7remShomGFW6cTjtCRAq5byfJ29tfFb9w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585162280218615.4999458662207; Wed, 25 Mar 2020 11:51:20 -0700 (PDT) Received: from localhost ([::1]:41576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHB7W-0006fS-PF for importer@patchew.org; Wed, 25 Mar 2020 14:51:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48534) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHB3w-00023z-Ph for qemu-devel@nongnu.org; Wed, 25 Mar 2020 14:47:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHB3v-0003do-OJ for qemu-devel@nongnu.org; Wed, 25 Mar 2020 14:47:36 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:36462) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jHB3v-0003dc-K8 for qemu-devel@nongnu.org; Wed, 25 Mar 2020 14:47:35 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-4-uGAW66vtMnyQ_pGfbPjzrg-1; Wed, 25 Mar 2020 14:47:33 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7E0EF8017DF; Wed, 25 Mar 2020 18:47:32 +0000 (UTC) Received: from localhost (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id F3AB160BF3; Wed, 25 Mar 2020 18:47:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585162055; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z41bJn5B0sKkbJNUSwdEnkMO1h3qMJLWpIO+ZqC84os=; b=bOzs0fEc1+rXm0pCNxTWYmKR2229xoZc1fMHzX/LxzZdRIm9Hde6cfv2YTxYCxXsLJ8MRy G/0gXwZK03V7zbhrHlboR32I5b4MyTRr6AHMiVnuwLlheoplxYyKV9Bvw1o4W4h0Ynp85U gan5rqj7SxNwEGEG4ljreKt+mWRfCsE= X-MC-Unique: uGAW66vtMnyQ_pGfbPjzrg-1 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH for-5.0 1/3] migration: fix cleanup_bh leak on resume Date: Wed, 25 Mar 2020 19:47:21 +0100 Message-Id: <20200325184723.2029630-2-marcandre.lureau@redhat.com> In-Reply-To: <20200325184723.2029630-1-marcandre.lureau@redhat.com> References: <20200325184723.2029630-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Juan Quintela , Michael Roth , Markus Armbruster , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Since commit 8c6b0356b53977bcfdea5299db07884915425b0c ("util/async: make bh_aio_poll() O(1)"), migration-test reveals a leak: QTEST_QEMU_BINARY=3Dx86_64-softmmu/qemu-system-x86_64 tests/qtest/migration-test -p /x86_64/migration/postcopy/recovery tests/qtest/libqtest.c:140: kill_qemu() tried to terminate QEMU process but encountered exit status 1 (expected 0) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D2082571=3D=3DERROR: LeakSanitizer: detected memory leaks Direct leak of 40 byte(s) in 1 object(s) allocated from: #0 0x7f25971dfc58 in __interceptor_malloc (/lib64/libasan.so.5+0x10dc58) #1 0x7f2596d08358 in g_malloc (/lib64/libglib-2.0.so.0+0x57358) #2 0x560970d006f8 in qemu_bh_new /home/elmarco/src/qemu/util/main-loop.= c:532 #3 0x5609704afa02 in migrate_fd_connect /home/elmarco/src/qemu/migration/migration.c:3407 #4 0x5609704b6b6f in migration_channel_connect /home/elmarco/src/qemu/migration/channel.c:92 #5 0x5609704b2bfb in socket_outgoing_migration /home/elmarco/src/qemu/migration/socket.c:108 #6 0x560970b9bd6c in qio_task_complete /home/elmarco/src/qemu/io/task.c= :196 #7 0x560970b9aa97 in qio_task_thread_result /home/elmarco/src/qemu/io/task.c:111 #8 0x7f2596cfee3a (/lib64/libglib-2.0.so.0+0x4de3a) Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Juan Quintela --- migration/migration.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index c1d88ace7f..fa8cca14c7 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3477,7 +3477,12 @@ void migrate_fd_connect(MigrationState *s, Error *er= ror_in) bool resume =3D s->state =3D=3D MIGRATION_STATUS_POSTCOPY_PAUSED; =20 s->expected_downtime =3D s->parameters.downtime_limit; - s->cleanup_bh =3D qemu_bh_new(migrate_fd_cleanup_bh, s); + if (resume) { + assert(s->cleanup_bh); + } else { + assert(!s->cleanup_bh); + s->cleanup_bh =3D qemu_bh_new(migrate_fd_cleanup_bh, s); + } if (error_in) { migrate_fd_error(s, error_in); migrate_fd_cleanup(s); --=20 2.26.0.rc2.42.g98cedd0233 From nobody Fri Apr 19 23:26:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585162190; cv=none; d=zohomail.com; s=zohoarc; b=nprdhAoNKm/4Kl77PdT4nOH3UdRiQLQC0e/nD0r9E+pTC03aM7I/TVXyW+Vuh69NKg566FnJ9HKJigSKtXKgt0ugwU8vE4CxEbgSUO5abgReu7cj4FIR4AYynpvObLpvuubIhmxLIjLAiCtrvp6Rnxa8qvCbSMEAf9xzhVbFZh4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585162190; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aSrDpOJDVeM9tHuSc2GcA4WUTyIk4RchNRoSM3u4/Ok=; b=LdcS48r/zL71oihP/zfbzg78drLIcUM0Oquq5W41nHbGtPnKCIGoERPZk/Fb3u0JcbEhoEkh1groR4pjQg4U1NGleUH84/oiIG0YawsirW0MdxcdWscWfNRmFleaEOz3wVTcRfPmk6oUzCqj2vSizhphdI8/lwJ31rB53ZoEOeE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585162190270684.7888861848738; Wed, 25 Mar 2020 11:49:50 -0700 (PDT) Received: from localhost ([::1]:41536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHB64-0003tp-RQ for importer@patchew.org; Wed, 25 Mar 2020 14:49:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48562) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHB46-00026t-1g for qemu-devel@nongnu.org; Wed, 25 Mar 2020 14:47:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHB43-0003fw-Si for qemu-devel@nongnu.org; Wed, 25 Mar 2020 14:47:44 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:46809) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jHB43-0003f8-1l for qemu-devel@nongnu.org; Wed, 25 Mar 2020 14:47:43 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-367-GczmsYeTMACUcUgtGZKtKw-1; Wed, 25 Mar 2020 14:47:38 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 657B2477; Wed, 25 Mar 2020 18:47:37 +0000 (UTC) Received: from localhost (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id F108A94B55; Wed, 25 Mar 2020 18:47:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585162059; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aSrDpOJDVeM9tHuSc2GcA4WUTyIk4RchNRoSM3u4/Ok=; b=GkW64n4UTnQyx9BSnWLpHjiT3mnPU9oCnDsRMKY24HqqRi9XsaEd1zJ+Wopa69JmEmgIB7 6j3jlD2/zNlEFhlzenFGqNPqvGzVSPDQM6KMZZCtWjLgYvsHDf2bXRf5QfM/cE1Wz3054c 13RUp6eM3nI8ATw4cRFQjXlVMfhN2qE= X-MC-Unique: GczmsYeTMACUcUgtGZKtKw-1 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH for-5.0 2/3] qmp: fix leak on callbacks that return both value and error Date: Wed, 25 Mar 2020 19:47:22 +0100 Message-Id: <20200325184723.2029630-3-marcandre.lureau@redhat.com> In-Reply-To: <20200325184723.2029630-1-marcandre.lureau@redhat.com> References: <20200325184723.2029630-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Juan Quintela , Michael Roth , Markus Armbruster , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Direct leak of 4120 byte(s) in 1 object(s) allocated from: #0 0x7fa114931887 in __interceptor_calloc (/lib64/libasan.so.6+0xb0887) #1 0x7fa1144ad8f0 in g_malloc0 (/lib64/libglib-2.0.so.0+0x588f0) #2 0x561e3c9c8897 in qmp_object_add /home/elmarco/src/qemu/qom/qom-qmp-= cmds.c:291 #3 0x561e3cf48736 in qmp_dispatch /home/elmarco/src/qemu/qapi/qmp-dispa= tch.c:155 #4 0x561e3c8efb36 in monitor_qmp_dispatch /home/elmarco/src/qemu/monito= r/qmp.c:145 #5 0x561e3c8f09ed in monitor_qmp_bh_dispatcher /home/elmarco/src/qemu/m= onitor/qmp.c:234 #6 0x561e3d08c993 in aio_bh_call /home/elmarco/src/qemu/util/async.c:136 #7 0x561e3d08d0a5 in aio_bh_poll /home/elmarco/src/qemu/util/async.c:164 #8 0x561e3d0a535a in aio_dispatch /home/elmarco/src/qemu/util/aio-posix= .c:380 #9 0x561e3d08e3ca in aio_ctx_dispatch /home/elmarco/src/qemu/util/async= .c:298 #10 0x7fa1144a776e in g_main_context_dispatch (/lib64/libglib-2.0.so.0+= 0x5276e) Signed-off-by: Marc-Andr=C3=A9 Lureau --- qapi/qmp-dispatch.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c index c30c7ff9e1..79347e0864 100644 --- a/qapi/qmp-dispatch.c +++ b/qapi/qmp-dispatch.c @@ -155,6 +155,8 @@ QDict *qmp_dispatch(const QmpCommandList *cmds, QObject= *request, cmd->fn(args, &ret, &err); qobject_unref(args); if (err) { + /* or assert(!ret) after reviewing all handlers: */ + qobject_unref(ret); goto out; } =20 --=20 2.26.0.rc2.42.g98cedd0233 From nobody Fri Apr 19 23:26:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585162218; cv=none; d=zohomail.com; s=zohoarc; b=EOMfvuaxIkJs+OPHa6HvIUNWaGfxSnK1bYN0hWwHXb9s2HwHBMj3F/uRrI1vUzqhtTYoxnR08/zV+/mq2YclBz7vlrLz1VWxMrzsZkBJwUl/LM6SMnDciE5uqlnTzm6PZIS25S5S5a8t0eWf9MIoxFXvOdTr1M/lHWqhXmc+98E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585162218; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qnv3awp4VN8xXiCk1fwWSqRez1nXNOKyCpBaU0jBJ4c=; b=Scb68Q0+jzoF9Ty9N3+ph1K6ZbV9sMiG+q79srdHqCqNQ04b4eqUqYJlDFxaMoIc68TvsLg0Sv5rAwSIi7vlN0H5nMFBU5N/S3zW9lS3a0JOWkOWm0CTJFmZPDuQ4Ikyhd7ND4EKYeklKbqnzR+VM5kJHHdSVCG8umU1rUzLg5A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585162218111253.15308246681536; Wed, 25 Mar 2020 11:50:18 -0700 (PDT) Received: from localhost ([::1]:41538 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHB6W-0004Ux-RP for importer@patchew.org; Wed, 25 Mar 2020 14:50:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48575) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHB47-00026z-4T for qemu-devel@nongnu.org; Wed, 25 Mar 2020 14:47:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHB46-0003gq-7A for qemu-devel@nongnu.org; Wed, 25 Mar 2020 14:47:47 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:60749) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jHB45-0003g5-AF for qemu-devel@nongnu.org; Wed, 25 Mar 2020 14:47:46 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-480-i5qjA_jkNumXA4kHX-4fOg-1; Wed, 25 Mar 2020 14:47:40 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7E0081005509; Wed, 25 Mar 2020 18:47:39 +0000 (UTC) Received: from localhost (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id AE7BB60BF3; Wed, 25 Mar 2020 18:47:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585162064; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qnv3awp4VN8xXiCk1fwWSqRez1nXNOKyCpBaU0jBJ4c=; b=KIEnuBo0stzaaOkzA44Fh75So3Cayk0l4K/VFdkBKacX90P09t3gLf8uKBUO79NtNEEAI/ CtuYBXtzC2VfbXK6BtUqfI8Pwe1Q8i+V24gJIerVc//NWo2/QVbUIUZrZJutLXIXo2M70G oWOrBDnFO6FFDoH21Gz/mCc/lI+Ng0M= X-MC-Unique: i5qjA_jkNumXA4kHX-4fOg-1 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH for-5.0 3/3] object-add: don't create return value if failed Date: Wed, 25 Mar 2020 19:47:23 +0100 Message-Id: <20200325184723.2029630-4-marcandre.lureau@redhat.com> In-Reply-To: <20200325184723.2029630-1-marcandre.lureau@redhat.com> References: <20200325184723.2029630-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Juan Quintela , Michael Roth , Markus Armbruster , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" If object-add failed, no need to create a return value that may later be leaked. Signed-off-by: Marc-Andr=C3=A9 Lureau Reported-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- qom/qom-qmp-cmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qom/qom-qmp-cmds.c b/qom/qom-qmp-cmds.c index 435193b036..6bd137ccbf 100644 --- a/qom/qom-qmp-cmds.c +++ b/qom/qom-qmp-cmds.c @@ -287,8 +287,8 @@ void qmp_object_add(QDict *qdict, QObject **ret_data, E= rror **errp) visit_free(v); if (obj) { object_unref(obj); + *ret_data =3D QOBJECT(qdict_new()); } - *ret_data =3D QOBJECT(qdict_new()); } =20 void qmp_object_del(const char *id, Error **errp) --=20 2.26.0.rc2.42.g98cedd0233