Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp589343rwe; Wed, 24 Aug 2022 06:11:35 -0700 (PDT) X-Google-Smtp-Source: AA6agR4h+f1m7jkD3K8xP+C7scr/k9OyP9SnerjH12Fwf89mzqTM861SN+gt5kKctNs5pJkWtcSu X-Received: by 2002:aa7:c6d2:0:b0:445:be64:98b7 with SMTP id b18-20020aa7c6d2000000b00445be6498b7mr7486455eds.164.1661346695247; Wed, 24 Aug 2022 06:11:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661346695; cv=none; d=google.com; s=arc-20160816; b=iTy2xIlKTINStxsBKz7Y7T3A0iuuOFDw3kV65PkzTAoQ1zhj58cbN0Bj6oinK14l1K vT9z2zfsOmFDBie+LeFH9hxbwJuBkbfAC3Y+6BVlY8flK/fvXF6s29WVgW/87BdkgvCX LosgIKOi3dmehknvZGrCAAR7MQlj6y5togkDz8vhHwtXcBXV1o/v/zEwSEqS17KVBevc 8Pped/kOuwBQxxpLIF2BpioQhZE66TKjAQCyl23lsWsJs+cxpukz6Bz3qozAz2J85b9B eBBiXGlvpy2/9a82fKR61XKZAUJe1e2tbsT7MYExLhgnS+o6TH+BFrP9p+wp9e8ShvRL HGrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uAW+kjtQa+80IfCy6IL5kC5fYW/7yUQfz0e6h9eDx6U=; b=xZp8uH1roTlAeAbxADWCal/epX6Eb/vC8+VA4SiZjdcqgYkkjVVWjfKiwoRfsBTAHY vl9TMc008RowysZyBbK2psV+QJg6qzrjdXjEdfRzG+2jgeIbETLeKe/ufawMjAcBg2Hs PXMHE/3mAQC9S2F2CwU6XaNm1y/1RKlo0XY8FYQ/Y847S7WdY7hKJj+HTndP+iG2ounO m9Yn6K2mZKMz3dgEyZkqoxvTPOVjKs1D77aGoQrDAOFH+iR8iVB90Lho6Sls/Wb5adrS 11lH6fCkFSsXwdR0yNflg4DwgB2HBuWLB+AGA1ox/nH2sG7jLKdLawpH7wdrhuQtGjod 50Bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sg+4drdG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v14-20020a50954e000000b004396851005fsi3972470eda.100.2022.08.24.06.11.08; Wed, 24 Aug 2022 06:11:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sg+4drdG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237658AbiHXMbW (ORCPT + 99 others); Wed, 24 Aug 2022 08:31:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237570AbiHXMaq (ORCPT ); Wed, 24 Aug 2022 08:30:46 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 454265E645 for ; Wed, 24 Aug 2022 05:30:39 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id c13-20020a17090a4d0d00b001fb6921b42aso1319955pjg.2 for ; Wed, 24 Aug 2022 05:30:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=uAW+kjtQa+80IfCy6IL5kC5fYW/7yUQfz0e6h9eDx6U=; b=sg+4drdGaUY0LXCOCdgTnN/ZEnFNJJMEUKPl/nG8dXzi/wXDo0Cy9Qcs0OZWYXWujr ANjd3KDHuAwF03KxA/R0ZkrhVe8EJskcMxn217hk4RFVNkwcRaf2i3OMk71GWXrBC7GI tAjBBv5Uf4jQoopGGauAR7XBmBY9loYhnvKpqTYh4lJSWMqJONSmQAu3MCF2oXI9U3Ma E3MT1K7nrp3gAK6js2fYyPaK5gLHjhL1NDXs1NGry2v5B6MuS2bQNJdeFV7ol4c8yDnx xhYT/BqjxBvf0ttvlVkMIAOs+okRT3NOO+K9dqu33H/a5XttQLO14caGiIfzJegCfVha aD9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=uAW+kjtQa+80IfCy6IL5kC5fYW/7yUQfz0e6h9eDx6U=; b=rMr9ElUGwL5pI/g6nNhJHDTLj8Q/f2P47T9x3Nb5aPHIs3BkLJlc7P0jSmw9Ph8kcz jH1JD+eMDocEDI0AQSwLGY8FMNaALcfHrHTg1tzUC5dc0msQJ3RFhY38OWUI5DRgUJte 32Y6yJeSJcsx6M7n6PkcAAngUKgdHj1Fe5vWR2MDMs8eT0ri5Fw8Q0uBCjkicNIaxw1j ZICqiab0/qrf9HE8WS08g9sv0qgIEmTU82tiLSz49WeOFba+whVoOIeiyNRptS+gLcdO uk28HRw9EbUfi7fk2cNYJ5nfnudVEprnkKwGeQmLKMjKzvFEWtqp706/obkHDYDCErdC NOSw== X-Gm-Message-State: ACgBeo0mHyonisbYcR5W4Thwpsvj2lOh9c4UQZMcSaizCB3P20981rvf cpn7bwqD31EygmxXpxOpV1P1 X-Received: by 2002:a17:90b:1d10:b0:1fb:e7b:270f with SMTP id on16-20020a17090b1d1000b001fb0e7b270fmr8180054pjb.192.1661344238634; Wed, 24 Aug 2022 05:30:38 -0700 (PDT) Received: from localhost.localdomain ([117.207.24.28]) by smtp.gmail.com with ESMTPSA id b3-20020a1709027e0300b00173031308fdsm3539220plm.158.2022.08.24.05.30.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 05:30:38 -0700 (PDT) From: Manivannan Sadhasivam To: kishon@ti.com, gregkh@linuxfoundation.org, lpieralisi@kernel.org Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, mie@igel.co.jp, kw@linux.com, Manivannan Sadhasivam Subject: [PATCH v2 5/5] tools: PCI: Fix memory leak Date: Wed, 24 Aug 2022 18:00:10 +0530 Message-Id: <20220824123010.51763-6-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220824123010.51763-1-manivannan.sadhasivam@linaro.org> References: <20220824123010.51763-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Memory allocated for "test" needs to be freed at the end of the main(). Fixes: 3f2ed8134834 ("tools: PCI: Add a userspace tool to test PCI endpoint") Signed-off-by: Manivannan Sadhasivam --- tools/pci/pcitest.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/pci/pcitest.c b/tools/pci/pcitest.c index a4e5b17cc3b5..a416a66802f3 100644 --- a/tools/pci/pcitest.c +++ b/tools/pci/pcitest.c @@ -157,7 +157,7 @@ static int run_test(struct pci_test *test) int main(int argc, char **argv) { - int c; + int c, ret; struct pci_test *test; test = calloc(1, sizeof(*test)); @@ -249,5 +249,8 @@ int main(int argc, char **argv) return -EINVAL; } - return run_test(test); + ret = run_test(test); + free(test); + + return ret; } -- 2.25.1