From patchwork Wed Jul 19 20:29:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 122831 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2707370vqt; Wed, 19 Jul 2023 14:05:56 -0700 (PDT) X-Google-Smtp-Source: APBJJlHiBkcQDK0WkXXa7CAgM1a6N4/K7V/Hhjf3S1k8O7yF1UEnoYiyy/tJCY0UywUXxqy2R0RE X-Received: by 2002:a17:906:290:b0:992:3897:1985 with SMTP id 16-20020a170906029000b0099238971985mr3041195ejf.43.1689800755756; Wed, 19 Jul 2023 14:05:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689800755; cv=none; d=google.com; s=arc-20160816; b=f2Wcp+TKS/ZPIuLw2lULVNZs9JH0+gACuF1OixRIZ58PYPD272ZI/0Sof9mh35cbX9 ItWi/W9uWBzDLU0MUSuJXRkQIQ4QU2pb/B7WU3ISlnnMwhx4i4xGEPYr0/SSZsNjV+Gc o7aOt4D47crqipwB9NP+FKIPTGdCj8hsWmCKIyySxcetiR3AggG3b6nGs01zgaJ/4d0e iqZ21OBwi+DBmk4srLTwN0PQepjE4TPFKN4Uml3Em1/vrmA5h9Kunk7lrxcb18Z1eRZc lqjlSTsFs6RHATI4N3qhd0GvmTWbHCvww4J2iQps5CKtoJi2mz3YeDhOaszLfO/Zdzut 4hYg== 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=IXT7UYfnSbJNyHxFpUiXrQuyVZPPhMZClE6jW2HfotI=; fh=GZ4eSIeu5yUrjQDUyFDhKHpL6itJkKQ8QAaBkaJW/mM=; b=rF+MxwZJuqnzbIRyLkrWAfGYX2hjjCxBlYkPjeMKEZfscS6IwlpWbYTAucfDFWxJMj cBkkdROtooCioD0MV43JYqrwKO+mz+BfoHABC5WvHdYcSV0VGcA4XYHk44W+I9VNTZWk ACk8rbSRltAuGQfBl3X2DZed+TplIZhZp7/pUKjSRWHkGO8u3wJoLPjc8nYxNuW+Mj3o EfQgi7MR6wXvqV2XttHOnhTwt43kY14n2ND1MkKixSwt5zqr+FAHC/nNnV67Y07X3b5O XtAIHxHcmLc+QUr0gGf/VQCjTQexkAWs9Qk1meEGOZnI+ybcfBtFvXoC717kuKWR+usc yfkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uEDfoUsm; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k16-20020a1709065fd000b009930294ae72si3703490ejv.293.2023.07.19.14.05.31; Wed, 19 Jul 2023 14:05:55 -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=@kernel.org header.s=k20201202 header.b=uEDfoUsm; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229732AbjGSUak (ORCPT + 99 others); Wed, 19 Jul 2023 16:30:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231467AbjGSUae (ORCPT ); Wed, 19 Jul 2023 16:30:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D6EE2D6B; Wed, 19 Jul 2023 13:30:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 20A0F617E4; Wed, 19 Jul 2023 20:30:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 040E5C433C9; Wed, 19 Jul 2023 20:29:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689798602; bh=goX2lDmeZF8/0WGZE1xE1qdjbTmkUWJAnLQ7R0lm72Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uEDfoUsmNHbSkzHppAbTaO7Bjutnh+Mbk65s/ZGip7I6hA5YOH15YX2cW4XZ6eJpF GMJkoUgXmOYSv+8MOjJALcIVIxVn6dQYiGhsRkyrHxF1+rEoUd/ddumTdQJ49py2Is t2sJFU/CKw/CpsNOL3FFNvriX0o0d1FlfUa9Ud8Jnx0UNDcoGhdfTZHQOSzZC0H6sr 9Sht3vtL4lMY8OW/GKYlpV9d8qXzb3auxYatV+sgHWf4IBcAaQ8tBTYZXo6pXKiRue 3QHErko/kiy0D/91MQrXtIwJnKZeurmpc4srG+kFVb3JknGMrbC5tqBBfGFa6aQruu 83MLGZFrO5XBQ== From: Arnaldo Carvalho de Melo To: Namhyung Kim Cc: Ingo Molnar , Thomas Gleixner , Jiri Olsa , Ian Rogers , Adrian Hunter , Clark Williams , Kate Carcia , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo Subject: [PATCH 1/6] perf evsel: Free evsel->filter on the destructor Date: Wed, 19 Jul 2023 17:29:46 -0300 Message-ID: <20230719202951.534582-2-acme@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230719202951.534582-1-acme@kernel.org> References: <20230719202951.534582-1-acme@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771884517397715422 X-GMAIL-MSGID: 1771884517397715422 From: Arnaldo Carvalho de Melo Noticed with: make EXTRA_CFLAGS="-fsanitize=address" BUILD_BPF_SKEL=1 CORESIGHT=1 O=/tmp/build/perf-tools-next -C tools/perf install-bin Direct leak of 45 byte(s) in 1 object(s) allocated from: #0 0x7f213f87243b in strdup (/lib64/libasan.so.8+0x7243b) #1 0x63d15f in evsel__set_filter util/evsel.c:1371 #2 0x63d15f in evsel__append_filter util/evsel.c:1387 #3 0x63d15f in evsel__append_tp_filter util/evsel.c:1400 #4 0x62cd52 in evlist__append_tp_filter util/evlist.c:1145 #5 0x62cd52 in evlist__append_tp_filter_pids util/evlist.c:1196 #6 0x541e49 in trace__set_filter_loop_pids /home/acme/git/perf-tools/tools/perf/builtin-trace.c:3646 #7 0x541e49 in trace__set_filter_pids /home/acme/git/perf-tools/tools/perf/builtin-trace.c:3670 #8 0x541e49 in trace__run /home/acme/git/perf-tools/tools/perf/builtin-trace.c:3970 #9 0x541e49 in cmd_trace /home/acme/git/perf-tools/tools/perf/builtin-trace.c:5141 #10 0x5ef1a2 in run_builtin /home/acme/git/perf-tools/tools/perf/perf.c:323 #11 0x4196da in handle_internal_command /home/acme/git/perf-tools/tools/perf/perf.c:377 #12 0x4196da in run_argv /home/acme/git/perf-tools/tools/perf/perf.c:421 #13 0x4196da in main /home/acme/git/perf-tools/tools/perf/perf.c:537 #14 0x7f213e84a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f) Free it on evsel__exit(). Cc: Adrian Hunter Cc: Ian Rogers Cc: Jiri Olsa Cc: Namhyung Kim Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/evsel.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 762e2b2634a5532a..e41bc4d9925f69a4 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -1474,6 +1474,7 @@ void evsel__exit(struct evsel *evsel) perf_thread_map__put(evsel->core.threads); zfree(&evsel->group_name); zfree(&evsel->name); + zfree(&evsel->filter); zfree(&evsel->pmu_name); zfree(&evsel->group_pmu_name); zfree(&evsel->unit);