-2008-12-22 Joel Brobecker <brobecker@adacore.com>
+2008-12-22 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Fix memory double-free.
+ * completer.c (line_completion_function): Clear LIST after called xfree.
+
+2008-12-22 Joel Brobecker <brobecker@adacore.com>
* breakpoint.c (update_watchpoint): Adjust and extend the description
of this function. Fix one error message accordingly.
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);
+2008-12-22 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * gdb.base/completion.exp (Completing non-existing component): New test.
+
2008-12-21 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix for PR gdb/8648.
timeout { fail "(timeout) complete 'set follow-fork-mode'" }
}
+send_gdb "p values\[0\].nonex.\t"
+gdb_expect {
+ -re "Type struct some_struct has no component named nonex.\r\n$gdb_prompt $"\
+ { pass "Completing non-existing component" }
+ -re ".*$gdb_prompt $" { fail "Completing non-existing component" }
+ timeout { fail "(timeout) Completing non-existing component" }
+ eof { fail "(eof) Completing non-existing component #2" }
+ }
+# Double memory freeing gets found only on the second run:
+send_gdb "p values\[0\].nonex.\t"
+gdb_expect {
+ -re "Type struct some_struct has no component named nonex.\r\n$gdb_prompt $"\
+ { pass "Completing non-existing component #2" }
+ -re ".*$gdb_prompt $" { fail "Completing non-existing component #2" }
+ timeout { fail "(timeout) Completing non-existing component #2" }
+ eof { fail "(eof) Completing non-existing component #2" }
+ }
+
# Restore globals modified in this test...
if [info exists old_inputrc] {
set env(INPUTRC) $old_inputrc