* make-pascal_language-print_type-handle-varstring-nul.patch - Renable gcc-fortran for SLE-11. - Use system compiler (gcc 4.3.4) for testing all languages on SLE-11. - Maintenance script qa.sh: * Ignore all fails for SLE-11. - Maintenance script import-fedora.sh: * Use %patch -P N instead of deprecated %patchN. * Drop patch skips: * gdb-6.5-readline-long-line-crash-test.patch * gdb-6.7-charsign-test.patch * gdb-test-ivy-bridge.patch * gdb-ppc-power7-test.patch * gdb-6.3-bz140532-ppc-unwinding-test.patch - Patches added (import from fedora rawhide @ a27201b): * gdb-bz2196395-debuginfod-legacy-openssl-crash.patch * gdb-rhbz-2232086-cpp-ify-mapped-symtab.patch * gdb-rhbz-2232086-generate-dwarf-5-index-consistently.patch * gdb-rhbz-2232086-generate-gdb-index-consistently.patch * gdb-rhbz-2232086-reduce-size-of-gdb-index.patch * gdb-rhbz2232086-refactor-selftest-support.patch - Patches updated (import from fedora rawhide @ a27201b): * gdb-6.6-buildid-locate-rpm.patch * gdb-6.6-buildid-locate.patch * gdb-fedora-libncursesw.patch * gdb-rhbz2233961-CVE-2022-4806.patch * gdb-rhbz2233965-memory-leak.patch - Patches updated: * gdb-6.6-buildid-locate-rpm-suse.patch - Patches deleted (import from fedora rawhide @ a27201b): * gdb-rhbz1553104-s390x-arch12-test.patch * gdb-lineno-makeup-test.patch * gdb-6.3-bz202689-exec-from-pthread-test.patch * gdb-6.5-bz109921-DW_AT_decl_file-test.patch * gdb-6.5-ia64-libunwind-leak-test.patch * gdb-6.5-last-address-space-byte-test.patch * gdb-6.5-missed-trap-on-step-test.patch * gdb-6.5-sharedlibrary-path.patch * gdb-6.7-testsuite-stable-results.patch * gdb-6.8-bz442765-threaded-exec-test.patch * gdb-ccache-workaround.patch * gdb-opcodes-clflushopt-test.patch * gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch * gdb-rhbz1350436-type-printers-error.patch * gdb-rhbz2196395-debuginfod-legacy-openssl-crash.patch * gdb-rhel5.9-testcase-xlf-var-inside-mod.patch * gdb-test-pid0-core.patch - Patches deleted: * fixup-gdb-rhbz1553104-s390x-arch12-test.patch * fixup-2-gdb-rhbz1553104-s390x-arch12-test.patch * fixup-gdb-lineno-makeup-test.patch * fixup-gdb-6.6-buildid-locate-rpm.patch - Remove commented out mention of dropped patch gdb-fix-selftest-fails-with-gdb-build-with-O2-flto.patch. OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=383
116 lines
3.5 KiB
Diff
116 lines
3.5 KiB
Diff
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= <ahajkova@redhat.com>
|
|
Date: Sun, 1 Oct 2023 10:36:06 +0200
|
|
Subject: gdb-rhbz2233965-memory-leak.patch
|
|
|
|
;; Backport PR29925, Memory leak in find_abstract_instance
|
|
|
|
PR29925, Memory leak in find_abstract_instance
|
|
|
|
The testcase in the PR had a variable with both DW_AT_decl_file and
|
|
DW_AT_specification, where the DW_AT_specification also specified
|
|
DW_AT_decl_file. This leads to a memory leak as the file name is
|
|
malloced and duplicates are not expected.
|
|
|
|
I've also changed find_abstract_instance to not use a temp for "name",
|
|
because that can result in a change in behaviour from the usual last
|
|
of duplicate attributes wins.
|
|
|
|
PR 29925
|
|
* dwarf2.c (find_abstract_instance): Delete "name" variable.
|
|
Free *filename_ptr before assigning new file name.
|
|
(scan_unit_for_symbols): Similarly free func->file and
|
|
var->file before assigning.
|
|
|
|
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
|
|
--- a/bfd/dwarf2.c
|
|
+++ b/bfd/dwarf2.c
|
|
@@ -3441,7 +3441,6 @@ find_abstract_instance (struct comp_unit *unit,
|
|
struct abbrev_info *abbrev;
|
|
uint64_t die_ref = attr_ptr->u.val;
|
|
struct attribute attr;
|
|
- const char *name = NULL;
|
|
|
|
if (recur_count == 100)
|
|
{
|
|
@@ -3602,9 +3601,9 @@ find_abstract_instance (struct comp_unit *unit,
|
|
case DW_AT_name:
|
|
/* Prefer DW_AT_MIPS_linkage_name or DW_AT_linkage_name
|
|
over DW_AT_name. */
|
|
- if (name == NULL && is_str_form (&attr))
|
|
+ if (*pname == NULL && is_str_form (&attr))
|
|
{
|
|
- name = attr.u.str;
|
|
+ *pname = attr.u.str;
|
|
if (mangle_style (unit->lang) == 0)
|
|
*is_linkage = true;
|
|
}
|
|
@@ -3612,7 +3611,7 @@ find_abstract_instance (struct comp_unit *unit,
|
|
case DW_AT_specification:
|
|
if (is_int_form (&attr)
|
|
&& !find_abstract_instance (unit, &attr, recur_count + 1,
|
|
- &name, is_linkage,
|
|
+ pname, is_linkage,
|
|
filename_ptr, linenumber_ptr))
|
|
return false;
|
|
break;
|
|
@@ -3622,7 +3621,7 @@ find_abstract_instance (struct comp_unit *unit,
|
|
non-string forms into these attributes. */
|
|
if (is_str_form (&attr))
|
|
{
|
|
- name = attr.u.str;
|
|
+ *pname = attr.u.str;
|
|
*is_linkage = true;
|
|
}
|
|
break;
|
|
@@ -3630,8 +3629,11 @@ find_abstract_instance (struct comp_unit *unit,
|
|
if (!comp_unit_maybe_decode_line_info (unit))
|
|
return false;
|
|
if (is_int_form (&attr))
|
|
- *filename_ptr = concat_filename (unit->line_table,
|
|
- attr.u.val);
|
|
+ {
|
|
+ free (*filename_ptr);
|
|
+ *filename_ptr = concat_filename (unit->line_table,
|
|
+ attr.u.val);
|
|
+ }
|
|
break;
|
|
case DW_AT_decl_line:
|
|
if (is_int_form (&attr))
|
|
@@ -3643,7 +3645,6 @@ find_abstract_instance (struct comp_unit *unit,
|
|
}
|
|
}
|
|
}
|
|
- *pname = name;
|
|
return true;
|
|
}
|
|
|
|
@@ -4139,8 +4140,11 @@ scan_unit_for_symbols (struct comp_unit *unit)
|
|
|
|
case DW_AT_decl_file:
|
|
if (is_int_form (&attr))
|
|
- func->file = concat_filename (unit->line_table,
|
|
- attr.u.val);
|
|
+ {
|
|
+ free (func->file);
|
|
+ func->file = concat_filename (unit->line_table,
|
|
+ attr.u.val);
|
|
+ }
|
|
break;
|
|
|
|
case DW_AT_decl_line:
|
|
@@ -4182,8 +4186,11 @@ scan_unit_for_symbols (struct comp_unit *unit)
|
|
|
|
case DW_AT_decl_file:
|
|
if (is_int_form (&attr))
|
|
- var->file = concat_filename (unit->line_table,
|
|
- attr.u.val);
|
|
+ {
|
|
+ free (var->file);
|
|
+ var->file = concat_filename (unit->line_table,
|
|
+ attr.u.val);
|
|
+ }
|
|
break;
|
|
|
|
case DW_AT_decl_line:
|