aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base
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/testsuite/gdb.base
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/testsuite/gdb.base')
-rw-r--r--gdb/testsuite/gdb.base/completion.exp18
1 files changed, 18 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp
index d0d0dd6..2d94fca 100644
--- a/gdb/testsuite/gdb.base/completion.exp
+++ b/gdb/testsuite/gdb.base/completion.exp
@@ -805,6 +805,24 @@ gdb_expect {
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