aboutsummaryrefslogtreecommitdiff
path: root/libctf/ctf-dump.c
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2019-06-03 20:26:02 +0100
committerNick Alcock <nick.alcock@oracle.com>2019-06-04 17:05:08 +0100
commit941accce38bc70a23c62e3c9439b67bf23298124 (patch)
tree995cef6235d637bfb7a2cb87cea03dab1ade001d /libctf/ctf-dump.c
parenta610aa4f9cf61d38b8e0fe60dfaac078d636089f (diff)
downloadgdb-941accce38bc70a23c62e3c9439b67bf23298124.zip
gdb-941accce38bc70a23c62e3c9439b67bf23298124.tar.gz
gdb-941accce38bc70a23c62e3c9439b67bf23298124.tar.bz2
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.
Diffstat (limited to 'libctf/ctf-dump.c')
-rw-r--r--libctf/ctf-dump.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libctf/ctf-dump.c b/libctf/ctf-dump.c
index c2ed791..82f63c2 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. */