]> git.pld-linux.org Git - packages/gdb.git/blame - gdb-pr12028-double-free.patch
- typo
[packages/gdb.git] / gdb-pr12028-double-free.patch
CommitLineData
51a5ef0f
PS
1http://sourceware.org/ml/gdb-patches/2010-09/msg00321.html
2Subject: [patch] PR 12028 "GDB crashes on a double free during overload resolution"
3
4old_cleanups was being set twice making the later call to
5discard_cleanups ignore the first 'make_cleanup' request.
6
7The patch is proposed for both head and the 7.2 branch.
8
9This has been regression tested on x8664 with gcc-4.4.4-10.fc13
10
11
12Fix PR 12028: "GDB crashes on a double free during overload resolution "
13
142010-09-16 Sami Wagiaalla <swagiaal@redhat.com>
15
16 PR C++/12028
17 * valops.c (find_oload_champ_namespace_loop): removed incorrect
18 'old_cleanups' reassignment.
19
202010-09-16 Sami Wagiaalla <swagiaal@redhat.com>
21
22 * gdb.cp/pr12028.cc: New.
23 * gdb.cp/pr12028.exp: New.
24
25diff --git a/gdb/testsuite/gdb.cp/pr12028.cc b/gdb/testsuite/gdb.cp/pr12028.cc
26new file mode 100644
27index 0000000..0fcab6b
28--- /dev/null
29+++ b/gdb/testsuite/gdb.cp/pr12028.cc
30@@ -0,0 +1,21 @@
31+class A{};
32+class B{};
33+class C: public B {};
34+
35+namespace D{
36+ int foo (A) { return 11; }
37+ int foo (C) { return 12; }
38+}
39+
40+int main()
41+{
42+ A a;
43+ B b;
44+ C c;
45+
46+ D::foo (a);
47+ // D::foo (b);
48+ D::foo (c);
49+
50+ return 0;
51+}
52diff --git a/gdb/testsuite/gdb.cp/pr12028.exp b/gdb/testsuite/gdb.cp/pr12028.exp
53new file mode 100644
54index 0000000..746c6b5
55--- /dev/null
56+++ b/gdb/testsuite/gdb.cp/pr12028.exp
57@@ -0,0 +1,29 @@
58+# Copyright 2008 Free Software Foundation, Inc.
59+
60+# This program is free software; you can redistribute it and/or modify
61+# it under the terms of the GNU General Public License as published by
62+# the Free Software Foundation; either version 3 of the License, or
63+# (at your option) any later version.
64+#
65+# This program is distributed in the hope that it will be useful,
66+# but WITHOUT ANY WARRANTY; without even the implied warranty of
67+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
68+# GNU General Public License for more details.
69+#
70+# You should have received a copy of the GNU General Public License
71+# along with this program. If not, see <http://www.gnu.org/licenses/>.
72+
73+set testfile pr12028
74+set srcfile ${testfile}.cc
75+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug c++}] } {
76+ return -1
77+}
78+
79+############################################
80+
81+if ![runto_main] then {
82+ perror "couldn't run to breakpoint main"
83+ continue
84+}
85+
86+gdb_test "p D::foo(b)" "Cannot resolve function foo to any overloaded instance"
87diff --git a/gdb/valops.c b/gdb/valops.c
88index 7fbad10..4e83a04 100644
89--- a/gdb/valops.c
90+++ b/gdb/valops.c
91@@ -2715,7 +2715,7 @@ find_oload_champ_namespace_loop (struct type **arg_types, int nargs,
92 function symbol to start off with.) */
93
94 old_cleanups = make_cleanup (xfree, *oload_syms);
95- old_cleanups = make_cleanup (xfree, *oload_champ_bv);
96+ make_cleanup (xfree, *oload_champ_bv);
97 new_namespace = alloca (namespace_len + 1);
98 strncpy (new_namespace, qualified_name, namespace_len);
99 new_namespace[namespace_len] = '\0';
This page took 0.12152 seconds and 4 git commands to generate.