Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1674657rwr; Thu, 20 Apr 2023 20:11:51 -0700 (PDT) X-Google-Smtp-Source: AKy350av4l3hURDXxtULaxYMeZ6fmZPquL49UHDAheDtzEtwBLyty5d4HjycUTuGPJ0pcmvN5f9v X-Received: by 2002:a05:6a20:1587:b0:f2:3ac0:eb4a with SMTP id h7-20020a056a20158700b000f23ac0eb4amr2913384pzj.14.1682046711444; Thu, 20 Apr 2023 20:11:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682046711; cv=none; d=google.com; s=arc-20160816; b=goN5AOrSAlw9qBnTUgX4iuGGFCekuLTGN2OjsOnVgYKoctOy6xyzyn9vpqmd+l/kEp u0wjQ5pgck/bgYRDYLjUFYKgA0m31fl14O6n8tx4ShfmObFAxTQzLdf4FiOBN3iW7lwk sR73rmzZMZOFzSTXz7ne+UOhVTTzRcPRqe+bJvXK89TdsKwDDud9Gnr7yjGh8VMmIpPm 9lgUzieDwveUK1jV2D/NTnEH+iscapmAcigc5PY2vReu4oDstqq0rW6AeFl2XAk4W0wJ b9jd13Tuy0ee7Mk4QcXJB8ba8sBmI8oXY5660rCdafTfEaUvU5FBsg+KQZtX67gEhn5E VfiQ== 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 :message-id:date:subject:cc:to:from; bh=dZMI03QH0x50lC/WdABmY1AUWBwX4PYilzp6TCCUtxY=; b=wP2S21/0sxYlUNRuXZzLvQPb2nc5KBETk/8B/btydDfSL4G0mvblPqmXH6xk7iYakI zwbFlCTc6l7vOLHHTsUNJuXNF3zz2Xb6OGLxo1XPnHjLoWjCT7LNCtBSz43hg+Cm2sDN Q5fuwrM2QxnS9m8+RRg7sQId0pZvqC7sDnrrNti6X1jn6L+9CppO5pWmUNa3mP1iJQ2+ EU6oSb2Qd1uAGZACgR/OfVZzIfUvQt/k5A2033mplt7QHEq8YrpnN/eRiaIPquIp+EcH TKasvKcCgMZ4+ldTIDNR+T3+h09LRCKbsWoiNBUca8QkSFcR2VLzY4FoJe4HPIN/GkDu UtVA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k186-20020a6384c3000000b0051b1d717745si3420049pgd.759.2023.04.20.20.11.38; Thu, 20 Apr 2023 20:11:51 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232833AbjDUDCs (ORCPT + 99 others); Thu, 20 Apr 2023 23:02:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233932AbjDUDB6 (ORCPT ); Thu, 20 Apr 2023 23:01:58 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9198F193; Thu, 20 Apr 2023 20:01:55 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Q2fNH6x7hz17W42; Fri, 21 Apr 2023 10:58:07 +0800 (CST) Received: from localhost.localdomain (10.67.174.95) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Fri, 21 Apr 2023 11:01:52 +0800 From: Yang Jihong To: , , , , , , , , , , CC: Subject: [PATCH] perf tracepoint: Fix memory leak in is_valid_tracepoint() Date: Fri, 21 Apr 2023 02:59:53 +0000 Message-ID: <20230421025953.173826-1-yangjihong1@huawei.com> X-Mailer: git-send-email 2.30.GIT MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.174.95] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 When is_valid_tracepoint() returns 1, need to call put_events_file() to free `dir_path`. Fixes: 25a7d914274d ("perf parse-events: Use get/put_events_file()") Signed-off-by: Yang Jihong --- tools/perf/util/tracepoint.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/perf/util/tracepoint.c b/tools/perf/util/tracepoint.c index 89ef56c43311..92dd8b455b90 100644 --- a/tools/perf/util/tracepoint.c +++ b/tools/perf/util/tracepoint.c @@ -50,6 +50,7 @@ int is_valid_tracepoint(const char *event_string) sys_dirent->d_name, evt_dirent->d_name); if (!strcmp(evt_path, event_string)) { closedir(evt_dir); + put_events_file(dir_path); closedir(sys_dir); return 1; } -- 2.30.GIT