tracing: Reset parser->buffer to allow multiple "puts"

trace_parser_put() simply frees the allocated parser buffer. But it does not
reset the pointer that was freed. This means that if trace_parser_put() is
called on the same parser more than once, it will corrupt the allocation
system. Setting parser->buffer to NULL after free allows it to be called
more than once without any ill effect.
Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent ae98d27a
...@@ -1193,6 +1193,7 @@ int trace_parser_get_init(struct trace_parser *parser, int size) ...@@ -1193,6 +1193,7 @@ int trace_parser_get_init(struct trace_parser *parser, int size)
void trace_parser_put(struct trace_parser *parser) void trace_parser_put(struct trace_parser *parser)
{ {
kfree(parser->buffer); kfree(parser->buffer);
parser->buffer = NULL;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment