Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp44861lqo; Tue, 7 May 2024 11:36:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWtkSoU6bL6dV2VuXcbRZRvF2vsRYdmWHchFfv/FsR/G00a1MnoB31nMnQAeqKoNBW9rVOxl9kdIhbter358IoyFotLR6F+C5+tIkFgjQ== X-Google-Smtp-Source: AGHT+IEp73EcgbAZ+pfFDIxtF4TpydodPGgbzWOj+AdnsfO3uQfmTFmoHntUWru/dsoRoVTYOe1i X-Received: by 2002:a05:6870:e3d2:b0:233:4c45:18c3 with SMTP id 586e51a60fabf-24097e79cb0mr476579fac.26.1715106996633; Tue, 07 May 2024 11:36:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715106996; cv=pass; d=google.com; s=arc-20160816; b=A525JntEbnoA5VwSJfyRjevn6Lbhr73rCgS4IlemZHn/ZfECwhsqTaaqLajMPDpOOj Mq/5qeSyjhxeR6nWC0AFiqW1F8wY66a9ZFmZxleFI1hwagaGp7k3QXXa+AgXbgyzVxO7 r+mTDfEV8ngqBfr6YToBqt51fP1kGzMk0kI+IoQBapPQ7qS4w4KWn/giB7fP51Feb4VW ePlv80J31wzShBv4zi92AJp5KVcIdiY3vzlE8Q9yax1NxHsvpCvxLThQOFEhCvQMA4wI FCPZ5s2PlvgNehxpHizxIpKAiCTkTl+EcEP5U9vB5xP2/Mate3sIuY5Z5Me5etV2r5lA L7fw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:from:subject:references:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:in-reply-to:date :dkim-signature; bh=nAyKMenex+5IJfc1qyffLzQhoa2twNpQD9DTMrkElUs=; fh=yKCOiBzVl1SVxblNakbJu24EGAbfG06wus03b7jTxnM=; b=UaK4imP7ARkvWkf2ZqQJ/+qky8YmiuAQtif+yJyvS0YtsSz6c9cRHr9fSOV93anA/a Ckwi/yHsOzyYI1x1COyUYV8KRXTU+7DrbMPxCcQUSbCWmSed5hFs7/ERpbbXYYsPGh1x 0W2LBQ72TlCAvaJCz4rkM3XJDjkJx4hj5zpS8p77XO3MJGQdouG4k7dtDT5qo2tKjXs2 L0uCNhlySthRo3hs8Mj3zsZsQSEY6ISYBP68hgSMqlnubytMKNYOkRGUZ0NdAFwVwFou 6gzRnbyHxyiT/uXPnIO8SKm+EjpuZ2WWlzlLR9nQp0zAqBsEXR7tDk1TCy+QS1MAapcN HWXA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=XvBeZ3Ig; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-171985-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171985-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id q10-20020a05622a04ca00b0043afbd20f4esi12674457qtx.503.2024.05.07.11.36.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 11:36:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-171985-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=XvBeZ3Ig; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-171985-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171985-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 319CA1C2232C for ; Tue, 7 May 2024 18:36:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6508316D331; Tue, 7 May 2024 18:36:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="XvBeZ3Ig" Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 35E0C16D9C2 for ; Tue, 7 May 2024 18:36:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715106970; cv=none; b=GJGqClbodiA1qHmI/Hw0vXss4462nmMHv2I7/Vi7UIdXq/fFTcRX82k0n2016JqrIBX20cICPXHkpR93qxNyVpteE37QiKDUnHzawO3f30Q4ClZR5WeG1VVhFXk7/1cjFwgVgFZDTuq2iw9Pz0XskB9gz2aExqKy/Iao3eVOges= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715106970; c=relaxed/simple; bh=yi0IGqXPFHWkzbXpu9EOHF2YNWNnFamLHfIdbg0rgmA=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=oY1HYt0SNFDRahtSmE09vfDaIErbMo9bHcsJuZYwTtxyq4GJzVKy+ggsSTmNK5EfKMTMJe0iaysRW0yF/HpO5q9f5JgBVCNBvIXbxWjFrbpq8aVCc34WRxvSlNpQhCsUEfsAznvMouIEn7N8V0/0Iu3MTS5aKZPkLVAsa0iV+GQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=XvBeZ3Ig; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-61e0c1f7169so594567b3.0 for ; Tue, 07 May 2024 11:36:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1715106968; x=1715711768; 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=nAyKMenex+5IJfc1qyffLzQhoa2twNpQD9DTMrkElUs=; b=XvBeZ3IgMzbSraWpzC4SXqHxAJ+8KWOPUSLhnknV1nVdBYsyCthNUQlUwdQ25BJPDF 8bvoCHNmJXQBhs7FLNygCaB4ENU4tVMDuNGYRj9xVycZxOQIwPReANoWhmXWadQhxCEZ TT+/qI2q/ok6RKmxHD9J585AhGFj29mlA4BkurJUTCNIVXybrcZtJDSFk1CC4snvZdEH hiVqJpX8pID1xdQquDLOfRKccKkc8uZbjEoEmM+qlCAjUHwgP6OiPQOZu0Hi9+NJ9IJe a32a3KtxqEjKv+rvPL06pkBZPpUJcpqL+TFCCvH0gz7mcLo0Y6xZm1mplWP1OqpNeyNv vLGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715106968; x=1715711768; 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=nAyKMenex+5IJfc1qyffLzQhoa2twNpQD9DTMrkElUs=; b=kvuy89j81AK2a1T6mNAw/l03K0geKJWRxN0S/8sg76IzpZwhGQHFCd1boBqF8ylmJ1 lUT7rX0pm/QYe/bI9Qqt8gJmqjjim1KaiIVIZJ0nakXgvNfiAQYDVCZydtXXsQCnSP3u /FbyDoVY1NmsZGuFncYlgu+x9D66KoRZmUpLF8mtCSQgi8Z+P1HntXWWS/4Z8CQhvpad U6DNgTJ/00kj3Q/9GBz4GCOMdXvxiH66a4iKkH0q7oyICxl14sR9QwHB5K6oNphI5MeR o1Gz3AE+5Hp6HUo18zwGTICN2HXV4yr+4QhVek65fzbZYLxjiSOhoVlVW7DlkcsOlDjd 7SAQ== X-Forwarded-Encrypted: i=1; AJvYcCWvIPp0+yfHH4KPAzu6yWVXnFoQX/pcLn51RYf4qqd5AtL1CUYVuDjDuirMpYi4zXlMtDsbXZLr4Zod5wKdVd0tNTQpUTpTa6PF4IGw X-Gm-Message-State: AOJu0Yxn8g7N6rc1rxzLoQ6woj2Gl+EDsAgMV74kvC5gvDy7IJ1mMjbK jqqxVtoHTY/bgPSV02ET3egRMcz0X3wbOJiRPArQg0/pieOqVkkv4/opxrDf8o/2MzGAG1df+Xi WrUGbcw== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:8095:fd7:9773:b1df]) (user=irogers job=sendgmr) by 2002:a81:a7c6:0:b0:618:9348:6b92 with SMTP id 00721157ae682-6207652d8a9mr8590217b3.1.1715106968260; Tue, 07 May 2024 11:36:08 -0700 (PDT) Date: Tue, 7 May 2024 11:35:39 -0700 In-Reply-To: <20240507183545.1236093-1-irogers@google.com> Message-Id: <20240507183545.1236093-3-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240507183545.1236093-1-irogers@google.com> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog Subject: [PATCH v1 2/8] perf annotate: Fix memory leak in annotated_source From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , Oliver Upton , James Clark , Tim Chen , Yicong Yang , K Prateek Nayak , Yanteng Si , Sun Haiyong , Kajol Jain , Ravi Bangoria , Li Dong , Paran Lee , Ben Gainey , Andi Kleen , Athira Rajeev , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Freeing hash map doesn't free the entries added to the hashmap, add missing free. Fixes: d3e7cad6f36d ("perf annotate: Add a hashmap for symbol histogram") Signed-off-by: Ian Rogers --- tools/perf/util/annotate.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index d7d55263fc91..a83722f32d6b 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -107,9 +107,15 @@ static struct annotated_source *annotated_source__new(void) static __maybe_unused void annotated_source__delete(struct annotated_source *src) { + struct hashmap_entry *cur; + size_t bkt; + if (src == NULL) return; + hashmap__for_each_entry(src->samples, cur, bkt) + zfree(&cur->pvalue); + hashmap__free(src->samples); zfree(&src->histograms); free(src); -- 2.45.0.rc1.225.g2a3ae87e7f-goog