From: Nick Alcock Date: Mon, 3 Jun 2019 19:26:02 +0000 (+0100) Subject: libctf: fix use-after-free in function dumping X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=941accce38bc70a23c62e3c9439b67bf23298124;p=binutils-gdb.git libctf: fix use-after-free in function dumping This is actually a free-before-initializing (i.e. a free of garbage). libctf/ * ctf-dump.c (ctf_dump_funcs): Free in the right place. --- diff --git a/libctf/ChangeLog b/libctf/ChangeLog index d059d58d19b..01b8d8da248 100644 --- a/libctf/ChangeLog +++ b/libctf/ChangeLog @@ -1,3 +1,7 @@ +2019-06-03 Nick Alcock + + * ctf-dump.c (ctf_dump_funcs): Free in the right place. + 2019-05-29 Nick Alcock * Makefile.am (ZLIB): New. diff --git a/libctf/ctf-dump.c b/libctf/ctf-dump.c index c2ed791eea6..82f63c29d00 100644 --- a/libctf/ctf-dump.c +++ b/libctf/ctf-dump.c @@ -273,7 +273,6 @@ ctf_dump_funcs (ctf_file_t *fp, ctf_dump_state_t *state) goto err; str = ctf_str_append (str, " "); - free (bit); /* Function name. */ @@ -290,6 +289,7 @@ ctf_dump_funcs (ctf_file_t *fp, ctf_dump_state_t *state) } str = ctf_str_append (str, bit); str = ctf_str_append (str, " ("); + free (bit); /* Function arguments. */