diff options
Diffstat (limited to 'tools/perf')
| -rw-r--r-- | tools/perf/util/probe-event.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 0dda25d82d06..e8c72de0f70c 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
| @@ -2307,10 +2307,17 @@ static int convert_name_to_addr(struct perf_probe_event *pev, const char *exec) | |||
| 2307 | function = NULL; | 2307 | function = NULL; |
| 2308 | } | 2308 | } |
| 2309 | if (!pev->group) { | 2309 | if (!pev->group) { |
| 2310 | char *ptr1, *ptr2; | 2310 | char *ptr1, *ptr2, *exec_copy; |
| 2311 | 2311 | ||
| 2312 | pev->group = zalloc(sizeof(char *) * 64); | 2312 | pev->group = zalloc(sizeof(char *) * 64); |
| 2313 | ptr1 = strdup(basename(exec)); | 2313 | exec_copy = strdup(exec); |
| 2314 | if (!exec_copy) { | ||
| 2315 | ret = -ENOMEM; | ||
| 2316 | pr_warning("Failed to copy exec string.\n"); | ||
| 2317 | goto out; | ||
| 2318 | } | ||
| 2319 | |||
| 2320 | ptr1 = strdup(basename(exec_copy)); | ||
| 2314 | if (ptr1) { | 2321 | if (ptr1) { |
| 2315 | ptr2 = strpbrk(ptr1, "-._"); | 2322 | ptr2 = strpbrk(ptr1, "-._"); |
| 2316 | if (ptr2) | 2323 | if (ptr2) |
| @@ -2319,6 +2326,7 @@ static int convert_name_to_addr(struct perf_probe_event *pev, const char *exec) | |||
| 2319 | ptr1); | 2326 | ptr1); |
| 2320 | free(ptr1); | 2327 | free(ptr1); |
| 2321 | } | 2328 | } |
| 2329 | free(exec_copy); | ||
| 2322 | } | 2330 | } |
| 2323 | free(pp->function); | 2331 | free(pp->function); |
| 2324 | pp->function = zalloc(sizeof(char *) * MAX_PROBE_ARGS); | 2332 | pp->function = zalloc(sizeof(char *) * MAX_PROBE_ARGS); |
