mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 22:14:03 +02:00
perf kvm: Do not copy filename string
As it removed STRDUP_FAIL_EXIT(), it no longer calls free() for elements in the copied argv. Thus, the filename should not be allocated as well. In fact, it's a pointer to string literals and should be fine to pass the pointer. Tested-by: Ian Rogers <irogers@google.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
parent
cd589eba99
commit
5169bd7647
|
|
@ -607,11 +607,11 @@ static const char *get_filename_for_perf_kvm(void)
|
|||
const char *filename;
|
||||
|
||||
if (perf_host && !perf_guest)
|
||||
filename = strdup("perf.data.host");
|
||||
filename = "perf.data.host";
|
||||
else if (!perf_host && perf_guest)
|
||||
filename = strdup("perf.data.guest");
|
||||
filename = "perf.data.guest";
|
||||
else
|
||||
filename = strdup("perf.data.kvm");
|
||||
filename = "perf.data.kvm";
|
||||
|
||||
return filename;
|
||||
}
|
||||
|
|
@ -2148,15 +2148,9 @@ int cmd_kvm(int argc, const char **argv)
|
|||
if (!perf_host)
|
||||
perf_guest = 1;
|
||||
|
||||
if (!file_name) {
|
||||
if (!file_name)
|
||||
file_name = get_filename_for_perf_kvm();
|
||||
|
||||
if (!file_name) {
|
||||
pr_err("Failed to allocate memory for filename\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen(argv[0]) > 2 && strstarts("record", argv[0]))
|
||||
return __cmd_record(file_name, argc, argv);
|
||||
else if (strlen(argv[0]) > 2 && strstarts("report", argv[0]))
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user