libtraceevent: Fix memleak in make_bprint_args()
PATCH 1/1 libtraceevent: Fix memleak in make_bprint_args()
From: Wang ShaoBo <[email protected]>
Release arg allocated from alloc_arg() when strdup failed in make_bprint_args().
Fixes 8b43424c32702 ("tools lib traceevent: Remove some die() calls")
Signed-off-by Wang ShaoBo <[email protected]>
Signed-off-by Steven Rostedt (Google) <[email protected]>
--- src/event-parse.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
src/event-parse.c +3 -1
@@ -4915,8 +4915,10 @@ static struct tep_print_arg *make_bprint_args(char *fmt, void *data, int size, s arg->next =NULL ; arg->type =TEP_PRINT_BSTRING ; arg->string.string =strdup (bptr); -if (!arg->string.string) +if (!arg->string.string) { +free (arg); goto out_free; + } bptr +=strlen (bptr) +1 ; *next = arg; next = &arg->next;
Signature · 1 line
2.35.1