From nobody Sat May 4 12:33:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; spf=pass (zoho.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=1559074898; cv=none; d=zoho.com; s=zohoarc; b=RMeCTWTeodYHnLXD/ahTa3+o7EB1H6UGVjQayR9s1VJRm2BWV26Zuy/EXlrqFhYpgoQjeoPEoM5wMz6YIiBKyX0itzenn1GnXThw8grC3Bwz70Uconrs57IGvkrr3pmEFBnn77RFh6/8L3KD8GPauRc+UIgu+01Wa2qqDzC78tU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559074898; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=3SsrSi6bD9AnD1Oo0QL8LzTDbnONXQ2j4w+MqpNSl0s=; b=DxITvLjqfRqVSdqlo+BOal8DlucpFvWqmNTjJOJxbfXd1Sd9qcTagvJBhPeavVBTRwX2LXmiWX5sTRd3MNqNdo5XqhIX0PaLekch1ZH2d1uznAA7v7H2PKptoPP0uXEjP+lkDww9zZy1ge+vZJLkEaBHEfs6qAz2JiZomR6BEYA= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1559074898407217.35900594069687; Tue, 28 May 2019 13:21:38 -0700 (PDT) Received: from localhost ([127.0.0.1]:41938 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hViCI-0003s3-F9 for importer@patchew.org; Tue, 28 May 2019 15:55:46 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45943) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hViAX-0002sC-Pg for qemu-devel@nongnu.org; Tue, 28 May 2019 15:53:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hViAW-0003zh-Si for qemu-devel@nongnu.org; Tue, 28 May 2019 15:53:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45716) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hViAU-0003p4-Ot; Tue, 28 May 2019 15:53:54 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EFF2A30ADC7B; Tue, 28 May 2019 19:53:40 +0000 (UTC) Received: from localhost (unknown [10.40.205.223]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 883765C8A3; Tue, 28 May 2019 19:53:40 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Tue, 28 May 2019 21:53:38 +0200 Message-Id: <20190528195338.12376-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Tue, 28 May 2019 19:53:41 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] qemu-img: Fix options leakage in img_rebase() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" img_rebase() can leak a QDict in two occasions. Fix it. Coverity: CID 1401416 Fixes: d16699b64671466b42079c45b89127aeea1ca565 Fixes: 330c72957196e0ae382abcaa97ebf4eb9bc8574f Signed-off-by: Max Reitz Reviewed-by: John Snow --- qemu-img.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/qemu-img.c b/qemu-img.c index b0535919b1..86e1923acf 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -3347,6 +3347,7 @@ static int img_rebase(int argc, char **argv) out_baseimg, &local_err); if (local_err) { + qobject_unref(options); error_reportf_err(local_err, "Could not resolve backing filename: "); ret =3D -1; @@ -3359,7 +3360,9 @@ static int img_rebase(int argc, char **argv) */ prefix_chain_bs =3D bdrv_find_backing_image(bs, out_real_path); if (prefix_chain_bs) { + qobject_unref(options); g_free(out_real_path); + blk_new_backing =3D blk_new(BLK_PERM_CONSISTENT_READ, BLK_PERM_ALL); ret =3D blk_insert_bs(blk_new_backing, prefix_chain_bs, --=20 2.21.0