summaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2008-12-22 13:19:28 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2008-12-22 13:19:28 +0000
commit94923161f4aa9c75a27c8f56a68662cef6695713 (patch)
tree217fdc70da117746c92455999090fd7a79045b2c /gdb/testsuite
parent6d5935ce5358685aebb1f3c0717208dfe2bef69c (diff)
downloadgdb-94923161f4aa9c75a27c8f56a68662cef6695713.tar.gz
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')
-rw-r--r--gdb/testsuite/ChangeLog4
-rw-r--r--gdb/testsuite/gdb.base/completion.exp18
2 files changed, 22 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index efa6234ca05..d5ae44852e4 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+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.
diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp
index d0d0dd6ba3b..2d94fcab479 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