From patchwork Mon May 3 16:55:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 430610 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp3017407jao; Mon, 3 May 2021 09:58:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0T4hafuwiNZ4g9ANjy2LcWqHBPHnu7QQ7LqE61eBoSt9cOTuwQKz6kUOUYE6xSHkuKZh7 X-Received: by 2002:a6b:ed11:: with SMTP id n17mr7039821iog.171.1620061091451; Mon, 03 May 2021 09:58:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620061091; cv=none; d=google.com; s=arc-20160816; b=rhPlzU+2VisqCyMYmE86yOYhhKCVKLgQRPLtNW2mdW9pghXbo9Jlq5FFqbx1UYAU8f nUTAZuRyK5CWroeLMIvv1yOe+v+cQ+9jFD+QGX7K7iisIatP6gLyiR769eF1uqoU5er/ ON41c+K+EbfzXRjq8lm3P993b9QqlUWWUzdHv+hxcieI/vj/YryX0jmU1PrDwUVR5Y98 bI0qXCUHYU52PCjUwnPgygCwF0O+En1YOJUx97a0B2a9jt8MC37WX0D+H0UySw0R51tn IjLFtOx8BFNcxnusw0cv7SyZox7HC+boPZVwn/ASfOToSZpqJO6q/D8YIpHehzLefAHp 42qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=0X6grANLwk+ExZnCAqsNBYR2iXdC0Vt7l7CQDrbCCds=; b=SUSTk0ApH286nlI8DJs6NE0+e99kkIcVbr4hLmvnRxglErPbxyiO0juoELb5HBwqHe E4GYLWPsAbIzvpdLDyugx70GrkkL2oJqA9v+QyY6C4mTD1BtPDdszrL6TcMCU4NN55va cMplejsjR3u39aXTOLRig2aH8vKtRh2KUgq/YA3KyBLrGnt7smBHAVZkR3za/CTGFzVY +dEBlcjfa4v/ZZ58Y0u07U3+FQ1MBWZs3/P91Y30shJUlkD/vhR8hvMnQikVIahnBl5j X+5ak5v9BbxEwxn40PULrb9wt33ps4xO2n4gGpCS4d7GlsdXrHD+WOKY/1csujspnSZP ZicQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=pgcTQqQi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f15si168928iow.16.2021.05.03.09.58.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 May 2021 09:58:11 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=pgcTQqQi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:44776 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldbta-0005FG-St for patch@linaro.org; Mon, 03 May 2021 12:58:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44512) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldbr6-0002B2-Tw for qemu-devel@nongnu.org; Mon, 03 May 2021 12:55:37 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:42790) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ldbr0-0003wa-SL for qemu-devel@nongnu.org; Mon, 03 May 2021 12:55:36 -0400 Received: by mail-wr1-x434.google.com with SMTP id l2so6301543wrm.9 for ; Mon, 03 May 2021 09:55:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0X6grANLwk+ExZnCAqsNBYR2iXdC0Vt7l7CQDrbCCds=; b=pgcTQqQi4c+8651MpF6VT7qy9wgG0PklaNSRcSzaRNqKI+bvBLftxuTJ9g5HJ4y5nx DR+25tHSjSjDmg3GI8/yfx41T7rBWOzFiY6nxKxDq14Unqv3MQbTj904cou5+FN6hqLJ T5uN2x6GS2oGMOJlEDOM5KFMZLB3FlwDmQ/A/7/QYQ1Lzl/o2RZPaZ5N5W9eFZkSarrh 7oY5YWsuHhGwhomvlTdQBHIa1n4tf70hrV1k3spS+NMWBCeIGnxsG/xqqzL4A4juAZ5f dPLhGjqJWVWwSYExg6lYcNvqEyP22q1A8mxLBN9aCNcThbhAZWLvejiplWjAFW0+LpJK kHHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0X6grANLwk+ExZnCAqsNBYR2iXdC0Vt7l7CQDrbCCds=; b=HcFlOyX1/Wn2Ew44mmoCkMgAOUCLh8gYWAMU1fy/iHguHz64ScCoNKgKqZRsbQmpgq HzfWkDLtMgSbDry3ij/KcUNyTNxUwv5L5lv+WwwyZnorHL2Qufnjo6RtzMS3DZDxCKwU 7hVz6O9mXLmucWSA/6wlJC2+5ZNtJt2NTjF40t+g9bLcoUUCJvXBz2ndG40HmeHGCcB+ pJ1KsnzOVjzUy+L1etNUSSj+uchmShtqghDw92XWsIenspSH5I/rohezuAnLVK4l10Sc uYje1WzoA2irxTAuB0F3OuY/gc6EN+MHF3PGDSQTe+A94yoWD2Le5oQKKajL12zJeBlI 72XQ== X-Gm-Message-State: AOAM531wbiXr/KjTvMNXU8LhJW5pWaIT7tVOS0C3XWMjXaqy0DeDa1WN HquBmDhTjwpiJf5RYC0Uvo6k9sEpb5v9ww== X-Received: by 2002:adf:ef4d:: with SMTP id c13mr25740095wrp.277.1620060929081; Mon, 03 May 2021 09:55:29 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id l12sm15282794wrq.36.2021.05.03.09.55.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 09:55:28 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH 1/3] tests/qtest/tpm-util.c: Free memory with correct free function Date: Mon, 3 May 2021 17:55:23 +0100 Message-Id: <20210503165525.26221-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210503165525.26221-1-peter.maydell@linaro.org> References: <20210503165525.26221-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: Laurent Vivier , Paolo Bonzini , Thomas Huth , Corey Minyard , Stefan Berger Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" tpm_util_migration_start_qemu() allocates memory with g_strdup_printf() but frees it with free() rather than g_free(), which provokes Coverity complaints (CID 1432379, 1432350). Use the correct free function. Fixes: Coverity CID 1432379, CID 1432350 Signed-off-by: Peter Maydell --- With newer glib (2.46 and up) g_free() is guaranteed to be the same as free(), but matching things up is neater anyway. --- tests/qtest/tpm-util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.20.1 Reviewed-by: Stefan Berger Reviewed-by: Alex Bennée diff --git a/tests/qtest/tpm-util.c b/tests/qtest/tpm-util.c index b70cc32d600..3a40ff3f96c 100644 --- a/tests/qtest/tpm-util.c +++ b/tests/qtest/tpm-util.c @@ -289,6 +289,6 @@ void tpm_util_migration_start_qemu(QTestState **src_qemu, *dst_qemu = qtest_init(dst_qemu_args); - free(src_qemu_args); - free(dst_qemu_args); + g_free(src_qemu_args); + g_free(dst_qemu_args); }