Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2185284rda; Tue, 24 Oct 2023 15:25:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEd9qjUQJyQ9qWSxOfRNVAngSwCbs1BabL2E2x370sdcCHFmr53z5AbL0ddQw0AP0z/BBlS X-Received: by 2002:a17:903:2291:b0:1c0:a5c9:e072 with SMTP id b17-20020a170903229100b001c0a5c9e072mr12575572plh.11.1698186336904; Tue, 24 Oct 2023 15:25:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698186336; cv=none; d=google.com; s=arc-20160816; b=YLFRnoFd3mKSckDZfY9z72VoYq5+GNOoz3vhAj8Hwn4C74lgd1BrWbZnufIEkfAMOI yIxLevu/ylj/T+sRrheujD70wTF1WDP2LrMhGvYv2bzgtvbxQC920Dglg94/awKR8SWv MlvbqkkD1KhdRns3eFExcqY2J8Wwmb7L31gtFRlCvyhv8WXNYgVB1gWm/MKcEVnJF+zT B8fYjm/11jlwbh//i6cnbhf7UVtpW1HDa2ZhOkAVha9QrfRks2x3g7I7GcoPy0ipYm2P uE+tIQyV5ivtvNcPshTJj/c705VecqePlMp4qS53MiUChzrXFVapmWraK5q1iKludQk+ JEHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=b/WYylQjwixRJXAqoqT9x2vsT/egkNyyGQzseJqJY9U=; fh=NAro5oTsDEB2Or99ABwb774QJkwQSkr6EoLVqn/Yde0=; b=pAS+Pz0r9miixGjH23H6iHT9sDu/qK2LCAfEnEfiHwdlZ7Eb4c0RQ+UG3atOKLpCGc dGBu1UBzWREkoz+39prwo8FnKNuOz03WZkIa69QBUF2FwrcZIlsn5KLWL7U0FXN0RWZ7 kOifb6phKNhOWHq59lul5tteLYaUqdIale04pJz5YYbceVjrs6z5+LlRnZIAhB6UmfWI AbOaZoKnQ4Ky9c4GxE9ajQuyqFMONaCBMFFHxxQSobkonhDfQdz7Nt0dKsLmnrQjhzm/ l+BT+uRSBNWtyPNG33bifdhoxXpW7JOkohDKKObCMGdG30Mt0mIapQFb3/k1LRrzFo1H xFqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=uT7w4lEc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id g19-20020a170902869300b001c9d4d2460fsi8832039plo.30.2023.10.24.15.25.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 15:25:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=uT7w4lEc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id C1F1880B64EF; Tue, 24 Oct 2023 15:25:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344408AbjJXWYv (ORCPT + 99 others); Tue, 24 Oct 2023 18:24:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344440AbjJXWYl (ORCPT ); Tue, 24 Oct 2023 18:24:41 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D98110DB for ; Tue, 24 Oct 2023 15:24:29 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-5a92864859bso45292427b3.0 for ; Tue, 24 Oct 2023 15:24:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698186268; x=1698791068; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=b/WYylQjwixRJXAqoqT9x2vsT/egkNyyGQzseJqJY9U=; b=uT7w4lEcUTQXJpCxjyDA/TSOS6e54jIhBLpvXasOjLYIoosAK7q2RldpGD5bsFz2Hl 4WibsMTU5PYsS12Lb6iMR5AKHHZEhAFUbW7FyAf/fdqHr0KuuLmcRmHLi98Srsqc1j7w URJ+83mJ5RWs4be6uAGHMoYyGoQpX+jFmSYNDHwPPD42UqnlXo1MKVHASfxJLu+ZxPzw a5ZcpmOovxvmtoo4hoJLDgDdjNS2Pm4CRsQQMARVAzqlat11bLb1eNkRtmcIM3XDh5wP KK+DRATMsBx1DWH7gPycIrobSjpCz/+4X9eVnb6shk7EnuS2Ps8fvOvlcjGsuDfSIED/ qpCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698186268; x=1698791068; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=b/WYylQjwixRJXAqoqT9x2vsT/egkNyyGQzseJqJY9U=; b=f3sfyS/rWDCFCR1Rg7Ib9/hSRZ37YDFPag1baJJrEQaY5JadGD94O6M62VIjCYAnH4 /eDQTr/jMkhoIudobwbtzznt2mgg06FABgQbvQSnlHd8kv2DsKRFT9RvxMf2HVYFqIvo S2TyI6x9FKNuVntDILAQ2YKW7rQRBckqMXpf8g02Tb58lTZGll8tQhm95uQ7k5AzJk3/ bkc3oyrFYLHHC3BoGVxpQLONx+mr3EFCEH5PEJHRzPnXRiGE6QwnEGjpkxgDXG4Oap7z plzAMn9W5Pw4IG6amu4HUaKd+lDAzMMXnJMSwwzAWA2B/kpKCfzM7xdqKX+Gg7aQU1Kj 8Rag== X-Gm-Message-State: AOJu0YynMx+IE+4+EWJygcgu1D6NrkdHW2bnDcr/6yh/tFnZiTzpaX6R rwsyoOuVb711N46eEMnnPCTT6PPjVsLx X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:93d2:18cc:4d63:45ba]) (user=irogers job=sendgmr) by 2002:a81:4c8f:0:b0:59f:3cde:b33a with SMTP id z137-20020a814c8f000000b0059f3cdeb33amr57926ywa.6.1698186268457; Tue, 24 Oct 2023 15:24:28 -0700 (PDT) Date: Tue, 24 Oct 2023 15:23:10 -0700 In-Reply-To: <20231024222353.3024098-1-irogers@google.com> Message-Id: <20231024222353.3024098-8-irogers@google.com> Mime-Version: 1.0 References: <20231024222353.3024098-1-irogers@google.com> X-Mailer: git-send-email 2.42.0.758.gaed0368e0e-goog Subject: [PATCH v3 07/50] perf offcpu: Add missed btf_free From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Nick Terrell , Kan Liang , Andi Kleen , Leo Yan , Song Liu , Sandipan Das , James Clark , Anshuman Khandual , Miguel Ojeda , Liam Howlett , Yang Jihong , Athira Rajeev , Kajol Jain , K Prateek Nayak , Sean Christopherson , Yanteng Si , Ravi Bangoria , German Gomez , Changbin Du , Paolo Bonzini , Masami Hiramatsu , liuwenyu , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 24 Oct 2023 15:25:25 -0700 (PDT) Caught by address/leak sanitizer. Signed-off-by: Ian Rogers --- tools/perf/util/bpf_off_cpu.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/perf/util/bpf_off_cpu.c b/tools/perf/util/bpf_off_cpu.c index 21f4d9ba023d..6af36142dc5a 100644 --- a/tools/perf/util/bpf_off_cpu.c +++ b/tools/perf/util/bpf_off_cpu.c @@ -98,22 +98,22 @@ static void off_cpu_finish(void *arg __maybe_unused) /* v5.18 kernel added prev_state arg, so it needs to check the signature */ static void check_sched_switch_args(void) { - const struct btf *btf = btf__load_vmlinux_btf(); + struct btf *btf = btf__load_vmlinux_btf(); const struct btf_type *t1, *t2, *t3; u32 type_id; type_id = btf__find_by_name_kind(btf, "btf_trace_sched_switch", BTF_KIND_TYPEDEF); if ((s32)type_id < 0) - return; + goto cleanup; t1 = btf__type_by_id(btf, type_id); if (t1 == NULL) - return; + goto cleanup; t2 = btf__type_by_id(btf, t1->type); if (t2 == NULL || !btf_is_ptr(t2)) - return; + goto cleanup; t3 = btf__type_by_id(btf, t2->type); /* btf_trace func proto has one more argument for the context */ @@ -121,6 +121,8 @@ static void check_sched_switch_args(void) /* new format: pass prev_state as 4th arg */ skel->rodata->has_prev_state = true; } +cleanup: + btf__free(btf); } int off_cpu_prepare(struct evlist *evlist, struct target *target, -- 2.42.0.758.gaed0368e0e-goog