Skip to content

Commit 4bf6dca

Browse files
tititiou36acmel
authored andcommitted
perf probe: Fix an error handling path in 'parse_perf_probe_command()'
If a memory allocation fail, we should branch to the error handling path in order to free some resources allocated a few lines above. Fixes: 15354d5 ("perf probe: Generate event name with line number") Signed-off-by: Christophe JAILLET <[email protected]> Acked-by: Masami Hiramatsu <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: [email protected] Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: https://lore.kernel.org/r/b71bcb01fa0c7b9778647235c3ab490f699ba278.1659797452.git.christophe.jaillet@wanadoo.fr Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 46f7bd5 commit 4bf6dca

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tools/perf/util/probe-event.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,8 +1775,10 @@ int parse_perf_probe_command(const char *cmd, struct perf_probe_event *pev)
17751775
if (!pev->event && pev->point.function && pev->point.line
17761776
&& !pev->point.lazy_line && !pev->point.offset) {
17771777
if (asprintf(&pev->event, "%s_L%d", pev->point.function,
1778-
pev->point.line) < 0)
1779-
return -ENOMEM;
1778+
pev->point.line) < 0) {
1779+
ret = -ENOMEM;
1780+
goto out;
1781+
}
17801782
}
17811783

17821784
/* Copy arguments and ensure return probe has no C argument */

0 commit comments

Comments
 (0)