Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Ian Rogers and committed by
Arnaldo Carvalho de Melo
88300913 8330d092

+2 -1
+2 -1
tools/perf/builtin-trace.c
··· 1653 1653 1654 1654 static void thread_trace__free_files(struct thread_trace *ttrace) 1655 1655 { 1656 - for (int i = 0; i < ttrace->files.max; ++i) { 1656 + for (int i = 0; i <= ttrace->files.max; ++i) { 1657 1657 struct file *file = ttrace->files.table + i; 1658 1658 zfree(&file->pathname); 1659 1659 } ··· 1699 1699 1700 1700 if (file != NULL) { 1701 1701 struct stat st; 1702 + 1702 1703 if (stat(pathname, &st) == 0) 1703 1704 file->dev_maj = major(st.st_rdev); 1704 1705 file->pathname = strdup(pathname);