From nobody Thu Nov 13 22:13:55 2025 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; 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 ARC-Seal: i=1; a=rsa-sha256; t=1582686969; cv=none; d=zohomail.com; s=zohoarc; b=YVgOrereuV7V6DBxByBx+yirQQHWJndCPtzYM62ORDC1SOFqWWxFz36FPUUzs74rNYYRUlmpt2yDd5ugfuIwBcqnrQtbIkMmBAXybLfgq7jk6dja2UOSdeTEs1H4nMPK5sIUjp8GOO3ofaltRPBBDC3OoyjJktoGUcIjEjT4YqM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582686969; h=Content-Type: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=ApKkV5ZoZn6aDGS/clw8Ll+u34iIBaRF64agvQLlZbw=; b=gh/C2O/1VuPF2ZY/1QAsasNUCYFSBseaMjlYuxl9XVycPWVD4kosb0hM8VtJ2XLHnVZ/cqqv7suHcKeYDs61nT3WN+EkvSe7IgbQE0GbwWaMsXshaGTnOZcI7HXP7AOcGt0DauSH6wnvxRKFRNmSzkZ0CBSsW1VK6Xcath+IdHo= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1582686969772301.19508458098437; Tue, 25 Feb 2020 19:16:09 -0800 (PST) Received: from localhost ([::1]:37484 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6nB9-000701-N0 for importer@patchew.org; Tue, 25 Feb 2020 22:16:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50853) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6nAI-0005st-2Z for qemu-devel@nongnu.org; Tue, 25 Feb 2020 22:15:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6nAH-00056I-5s for qemu-devel@nongnu.org; Tue, 25 Feb 2020 22:15:14 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:39988 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j6nAD-0004iF-MS; Tue, 25 Feb 2020 22:15:09 -0500 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 1F45053AC6E7DA7C46AF; Wed, 26 Feb 2020 11:15:05 +0800 (CST) Received: from localhost.localdomain (10.175.104.216) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.439.0; Wed, 26 Feb 2020 11:14:58 +0800 From: Pan Nengyuan To: , Subject: [PATCH 2/2] qemu-img: free memory before re-assign Date: Wed, 26 Feb 2020 11:30:37 +0800 Message-ID: <20200226033037.18253-3-pannengyuan@huawei.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20200226033037.18253-1-pannengyuan@huawei.com> References: <20200226033037.18253-1-pannengyuan@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.104.216] X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 45.249.212.32 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: euler.robot@huawei.com, Pan Nengyuan , qemu-devel@nongnu.org, qemu-block@nongnu.org, zhang.zhanghailiang@huawei.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" collect_image_check() is called twice in img_check(), the filename/format w= ill be alloced without free the original memory. It is not a big deal since the process will exit anyway, but seems like a c= lean code and it will remove the warning spotted by asan. Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- qemu-img.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qemu-img.c b/qemu-img.c index 2b4562b9d9..bcbca6c9a2 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -638,6 +638,8 @@ static int collect_image_check(BlockDriverState *bs, return ret; } =20 + g_free(check->filename); + g_free(check->format); check->filename =3D g_strdup(filename); check->format =3D g_strdup(bdrv_get_format_name(bs)); check->check_errors =3D result.check_errors; --=20 2.18.2