mirror of
https://github.com/torvalds/linux.git
synced 2026-11-24 23:47:06 +00:00
perf annotate: Fix memory leaks in LOCK handling
The lock prefix handling fails to free the strdup()'d name as well as the fields allocated by the instruction parsing. Signed-off-by: Rabin Vincent <[email protected]> Cc: Paul Mackerras <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
be81908c22
commit
0fb9f2aab7
@@ -177,6 +177,8 @@ static int lock__parse(struct ins_operands *ops)
|
||||
goto out_free_ops;
|
||||
|
||||
ops->locked.ins = ins__find(name);
|
||||
free(name);
|
||||
|
||||
if (ops->locked.ins == NULL)
|
||||
goto out_free_ops;
|
||||
|
||||
@@ -209,6 +211,13 @@ static int lock__scnprintf(struct ins *ins, char *bf, size_t size,
|
||||
|
||||
static void lock__delete(struct ins_operands *ops)
|
||||
{
|
||||
struct ins *ins = ops->locked.ins;
|
||||
|
||||
if (ins && ins->ops->free)
|
||||
ins->ops->free(ops->locked.ops);
|
||||
else
|
||||
ins__delete(ops->locked.ops);
|
||||
|
||||
zfree(&ops->locked.ops);
|
||||
zfree(&ops->target.raw);
|
||||
zfree(&ops->target.name);
|
||||
|
||||
Reference in New Issue
Block a user