]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
perf dso: Fix memory leak in dso__new_map()
authorRiccardo Mancini <rickyman7@gmail.com>
Thu, 15 Jul 2021 16:07:11 +0000 (18:07 +0200)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Mon, 20 Sep 2021 16:49:27 +0000 (18:49 +0200)
commit79667bb9a74363b465569ac1d831a45b6d89c777
tree80b65b9de1cec9b08c07d4faa00d5fafd65057e0
parentf5b2b2f34ee7709d3452a1c09e2326bd83458a99
perf dso: Fix memory leak in dso__new_map()

BugLink: https://bugs.launchpad.net/bugs/1939899
[ Upstream commit 581e295a0f6b5c2931d280259fbbfff56959faa9 ]

ASan reports a memory leak when running:

  # perf test "65: maps__merge_in".

The causes of the leaks are two, this patch addresses only the first
one, which is related to dso__new_map().

The bug is that dso__new_map() creates a new dso but never decreases the
refcount it gets from creating it.

This patch adds the missing dso__put().

Signed-off-by: Riccardo Mancini <rickyman7@gmail.com>
Fixes: d3a7c489c7fd2463 ("perf tools: Reference count struct dso")
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/60bfe0cd06e89e2ca33646eb8468d7f5de2ee597.1626343282.git.rickyman7@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
tools/perf/util/dso.c