From 94923161f4aa9c75a27c8f56a68662cef6695713 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Mon, 22 Dec 2008 13:19:28 +0000 Subject: 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. --- gdb/completer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gdb/completer.c') diff --git a/gdb/completer.c b/gdb/completer.c index d109140ee3e..4747a429801 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); -- cgit v1.2.1