Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2077195rdb; Mon, 9 Oct 2023 11:41:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFW4ppCGvcL8QdVVxci7ucX0704AxmN6BRK7/bOkF9vjcezMyHkqB8tTIOo9dp2tZe7QawU X-Received: by 2002:a05:6a20:4404:b0:169:9802:fd72 with SMTP id ce4-20020a056a20440400b001699802fd72mr14143371pzb.62.1696876883277; Mon, 09 Oct 2023 11:41:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696876883; cv=none; d=google.com; s=arc-20160816; b=sOPU3Xd6adIK9FY1NONuZFR6/26jp4NOsBXno7xjMqbOMEZSTeSQAFasd90DkF7apg iVJC/1J170+Z+MOrzgZTvriZHw1ZJHcUHH5NKbi9ypR8evC0r4N5lrRdRBZXi5+LYGz8 ZHZFljbeQrqC6AyKcfpLS2bRZzsPNDnBY2ID0uFHa/5suFgpcDmT+qGB3jlUsek2fjCc 4nv3FSQcK8eF90rJymeosZo+W40dgsUKOVXY5CQBVyxT2DwIaLUNMn0hTA1HTK2Uqc73 4prrOi45Znw/bBxVchYiDzcrQ56U8Q3Ix3x8mz58GaOL54ceaLOLbasg8dZpDRX4GYmn 4Hpw== 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=49ZawQt+7SlBsoWKownV7zVOA634acLMIh7oRlSswNg=; fh=8uoRd8OfBKdrcgzCS0TCbKG83gg6rx5b6zeE6Tx82zI=; b=NokTp4hEs8WLifgeJdL1rHXtC1zDFMlru3/nCq+usTf3R8KggofGEd2DYqoQcegHvN LfJhxkEx6bRW2+4+hMvN3Rp0vnYCV9u2BqR6am3KZ+I+wC0Zm5dHQEY8QkJYxrrd46p0 Ma/rVubPWQTDlxGMPCMf/AJG6112Beqi7v+PDciuVxdnqiX7JGR5hESm3uMEdVtMYffC 4dkZzubpLsYd3zN2lDR+SnSw+pA8cbjvVcCfL1HVW52fvGuK3pmq4EprjyLTlwIhZTB5 mBZRGy/R++t5gmh6fDl+Ro9Ga3kEKfGYNH77HIlzhJdchLThyoulgEfS+/8zL7ThIJwt y0PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=dK8xBnOo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id x29-20020a056a00189d00b0068fcb7125e1si8049429pfh.242.2023.10.09.11.41.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 11:41:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=dK8xBnOo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id D7FDD80ADEF0; Mon, 9 Oct 2023 11:41:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378233AbjJISk0 (ORCPT + 99 others); Mon, 9 Oct 2023 14:40:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378294AbjJISkQ (ORCPT ); Mon, 9 Oct 2023 14:40:16 -0400 Received: from mail-oo1-xc4a.google.com (mail-oo1-xc4a.google.com [IPv6:2607:f8b0:4864:20::c4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED25312C for ; Mon, 9 Oct 2023 11:39:57 -0700 (PDT) Received: by mail-oo1-xc4a.google.com with SMTP id 006d021491bc7-57be2b0e95cso6575072eaf.1 for ; Mon, 09 Oct 2023 11:39:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696876797; x=1697481597; 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=49ZawQt+7SlBsoWKownV7zVOA634acLMIh7oRlSswNg=; b=dK8xBnOoIO9PY75AnOE4rIYgmL4p62wsbAdA7DfZFtY6H+eeCIfzfIyLtFSxZIgtTE fTYV70F1erQqiuylGJWheixlo8jAsHDTaaZz3ekJzfxnLhpbM438SCkyiwNrRpZYl+En BaZ+kYT1gip/D41srBrzQBjcQUx7wGqRxtPuXXKF5RKFeChmf/6wd2+JoL4TrVEgLLwm Wo0U08kEkCjWGbUXkkofAYrZKvJMNg5wUCosR+f4vHDDkXsqNhEH5PTvDiBhI2w3PZbY E/yZgTJVuHjnlVUgFb5g49pVkctTzfFk+eB7J2PYExNF52p4Ll2VA6pdBrjjaOFODJVO hKXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696876797; x=1697481597; 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=49ZawQt+7SlBsoWKownV7zVOA634acLMIh7oRlSswNg=; b=oqviIRpSUdGMlab6RVU4v/+upMZOlPawIjnJulrAUvDD5SIV7HNKfhIaFKaJ8KSFw2 ZsrHR6xcWuHTf1wpLG2nIig9dcdGVb4j3CpVHMyjZQncHRelY82x0CU4xFow45UHS9tM QLMjGdvA3Z7V5paZoC1yq1s5euFQxr6Gq83qInqRsikSz285mMirj2Wo0a4C3bVq8L6y 00mdXfXp9VRPev9FdNqWXKjt6fNowZ1GE/5TngEJFFJsAMGhaNzR/ENXiCCxc0CyrPUL Zdg3QjEWL6kdyfjkYH4SwG6mAkNBSeyG5DOlfaql0e+HVoY9PP/yGXyaIyjJt0VTV6nX sgQg== X-Gm-Message-State: AOJu0Yy5H8BhdVMAHCUK0tnTU37Z+yvH9f7jChcBEiJpU/SwKYZoXhUU o3lOe/MbyijxZSRTelOguCogRMXlNfnx X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:ac4a:9b94:7158:3f4e]) (user=irogers job=sendgmr) by 2002:a05:6820:100d:b0:57f:10cb:516b with SMTP id v13-20020a056820100d00b0057f10cb516bmr3087810oor.0.1696876797162; Mon, 09 Oct 2023 11:39:57 -0700 (PDT) Date: Mon, 9 Oct 2023 11:39:14 -0700 In-Reply-To: <20231009183920.200859-1-irogers@google.com> Message-Id: <20231009183920.200859-14-irogers@google.com> Mime-Version: 1.0 References: <20231009183920.200859-1-irogers@google.com> X-Mailer: git-send-email 2.42.0.609.gbb76f46606-goog Subject: [PATCH v3 12/18] perf svghelper: Avoid memory leak From: Ian Rogers To: Nathan Chancellor , Nick Desaulniers , Tom Rix , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Yang Jihong , Huacai Chen , Ming Wang , Kan Liang , Ravi Bangoria , llvm@lists.linux.dev, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, bpf@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-4.8 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Mon, 09 Oct 2023 11:41:20 -0700 (PDT) On success path the sib_core and sib_thr values weren't being freed. Detected by clang-tidy. Signed-off-by: Ian Rogers --- tools/perf/util/svghelper.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c index 0e4dc31c6c9c..1892e9b6aa7f 100644 --- a/tools/perf/util/svghelper.c +++ b/tools/perf/util/svghelper.c @@ -754,6 +754,7 @@ int svg_build_topology_map(struct perf_env *env) int i, nr_cpus; struct topology t; char *sib_core, *sib_thr; + int ret = -1; nr_cpus = min(env->nr_cpus_online, MAX_NR_CPUS); @@ -799,11 +800,11 @@ int svg_build_topology_map(struct perf_env *env) scan_core_topology(topology_map, &t, nr_cpus); - return 0; + ret = 0; exit: zfree(&t.sib_core); zfree(&t.sib_thr); - return -1; + return ret; } -- 2.42.0.609.gbb76f46606-goog