Skip to content

Commit

Permalink
tools lib traceevent: Fix missed freeing of subargs in free_arg() in …
Browse files Browse the repository at this point in the history
…filter

Some of args were missed in free_args(), as well as subargs.

That is args like FILTER_ARG_NUM have left and right pointers to other
args that also need to be freed.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1349137408.22822.135.camel@gandalf.local.home
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Steven Rostedt authored and Arnaldo Carvalho de Melo committed Oct 16, 2012
1 parent 101782e commit 743df75
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tools/lib/traceevent/parse-filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,16 @@ static void free_arg(struct filter_arg *arg)
switch (arg->type) {
case FILTER_ARG_NONE:
case FILTER_ARG_BOOLEAN:
break;

case FILTER_ARG_NUM:
free_arg(arg->num.left);
free_arg(arg->num.right);
break;

case FILTER_ARG_EXP:
free_arg(arg->exp.left);
free_arg(arg->exp.right);
break;

case FILTER_ARG_STR:
Expand All @@ -218,6 +227,12 @@ static void free_arg(struct filter_arg *arg)
free(arg->str.buffer);
break;

case FILTER_ARG_VALUE:
if (arg->value.type == FILTER_STRING ||
arg->value.type == FILTER_CHAR)
free(arg->value.str);
break;

case FILTER_ARG_OP:
free_arg(arg->op.left);
free_arg(arg->op.right);
Expand Down

0 comments on commit 743df75

Please sign in to comment.