mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-11 12:44:49 -04:00
perf trace: Free the files.max entry in files->table
The files.max is the maximum valid fd in the files array and so freeing the values needs to be inclusive of the max value. Reviewed-by: Howard Chu <howardchu95@gmail.com> Signed-off-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/r/20250401202715.3493567-1-irogers@google.com [ split from a larger patch ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
8330d092f7
commit
8830091383
@@ -1653,7 +1653,7 @@ static const size_t trace__entry_str_size = 2048;
|
||||
|
||||
static void thread_trace__free_files(struct thread_trace *ttrace)
|
||||
{
|
||||
for (int i = 0; i < ttrace->files.max; ++i) {
|
||||
for (int i = 0; i <= ttrace->files.max; ++i) {
|
||||
struct file *file = ttrace->files.table + i;
|
||||
zfree(&file->pathname);
|
||||
}
|
||||
@@ -1699,6 +1699,7 @@ static int trace__set_fd_pathname(struct thread *thread, int fd, const char *pat
|
||||
|
||||
if (file != NULL) {
|
||||
struct stat st;
|
||||
|
||||
if (stat(pathname, &st) == 0)
|
||||
file->dev_maj = major(st.st_rdev);
|
||||
file->pathname = strdup(pathname);
|
||||
|
||||
Reference in New Issue
Block a user