diff options
author | Yang Jihong <yangjihong1@huawei.com> | 2024-01-19 07:03:02 +0300 |
---|---|---|
committer | Sasha Levin <sashal@kernel.org> | 2024-03-27 01:17:00 +0300 |
commit | 27ee265043ac0b18e6ea960a2a5d4c3383c01bea (patch) | |
tree | bc78dab0683048a340ee648234968ee92bd27ed7 /tools/perf | |
parent | a0188ea3dce9b0a99c0a05b86a1d33af5b9a6bfb (diff) | |
download | linux-27ee265043ac0b18e6ea960a2a5d4c3383c01bea.tar.xz |
perf record: Fix possible incorrect free in record__switch_output()
[ Upstream commit aff10a165201f6f60cff225083ce301ad3f5d8f1 ]
perf_data__switch() may not assign a legal value to 'new_filename'.
In this case, 'new_filename' uses the on-stack value, which may cause a
incorrect free and unexpected result.
Fixes: 03724b2e9c45 ("perf record: Allow to limit number of reported perf.data files")
Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20240119040304.3708522-2-yangjihong1@huawei.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/builtin-record.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 86c910125172..a8dfa533c166 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -1830,8 +1830,8 @@ static int record__switch_output(struct record *rec, bool at_exit) { struct perf_data *data = &rec->data; + char *new_filename = NULL; int fd, err; - char *new_filename; /* Same Size: "2015122520103046"*/ char timestamp[] = "InvalidTimestamp"; |