aboutsummaryrefslogtreecommitdiff
path: root/gdb/completer.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2008-12-22 13:19:30 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2008-12-22 13:19:30 +0000
commit6f4de6c97dfed92a46f3cd2d7d841b79da58ac81 (patch)
treeb060aea3209750b7566b8e5a00106f2c40460f05 /gdb/completer.c
parent567e1b4ec8fc6ef29e662987c5314f4cdb4bf287 (diff)
downloadgdb-6f4de6c97dfed92a46f3cd2d7d841b79da58ac81.zip
gdb-6f4de6c97dfed92a46f3cd2d7d841b79da58ac81.tar.gz
gdb-6f4de6c97dfed92a46f3cd2d7d841b79da58ac81.tar.bz2
gdb/
Fix memory double-free. * completer.c (line_completion_function): Clear LIST after called xfree. gdb/testsuite/ * gdb.base/completion.exp (Completing non-existing component): New test.
Diffstat (limited to 'gdb/completer.c')
-rw-r--r--gdb/completer.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gdb/completer.c b/gdb/completer.c
index d109140..4747a42 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -752,8 +752,10 @@ line_completion_function (const char *text, int matches,
if (list)
{
/* Free the storage used by LIST, but not by the strings inside.
- This is because rl_complete_internal () frees the strings. */
+ This is because rl_complete_internal () frees the strings.
+ As complete_line may abort by calling `error' clear LIST now. */
xfree (list);
+ list = NULL;
}
index = 0;
list = complete_line (text, line_buffer, point);