lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 21 Feb 2019 13:23:06 +0100
From:   Jonas Rabenstein <jonas.rabenstein@...dium.uni-erlangen.de>
To:     linux-perf-users@...r.kernel.org
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...hat.com>,
        Namhyung Kim <namhyung@...nel.org>,
        linux-kernel@...r.kernel.org,
        Jonas Rabenstein <jonas.rabenstein@...dium.uni-erlangen.de>
Subject: [PATCH] perf hist: fix memory leak if histogram entry is reused

In __hists__add_entry the srcline of the addr_location is duplicated
for the hist_entry. If hists__findnew_entry returns an already existing
hist_entry the srcline has to be freed again as no further reference to
that duplicated srcline would exists anymore.

Signed-off-by: Jonas Rabenstein <jonas.rabenstein@...dium.uni-erlangen.de>
---
 tools/perf/util/hist.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 8aad8330e392..25b8dbdbbe87 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -623,6 +623,9 @@ __hists__add_entry(struct hists *hists,
 		.ops = ops,
 	}, *he = hists__findnew_entry(hists, &entry, al, sample_self);
 
+	if (he && he->srcline != entry.srcline)
+		free(entry.srcline);
+
 	if (!hists->has_callchains && he && he->callchain_size != 0)
 		hists->has_callchains = true;
 	return he;
-- 
2.19.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ