aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2020-06-24 17:38:16 +0100
committerNick Clifton <nickc@redhat.com>2020-06-24 17:38:16 +0100
commitfb58f5e9286a7ea5c6f0977595c37f11087f5883 (patch)
treec7e7bb1734069b6c45623c003a877badde7c8430
parent4bf05d4a900ae2c6c59e173340cc087584e46c81 (diff)
downloadgdb-fb58f5e9286a7ea5c6f0977595c37f11087f5883.zip
gdb-fb58f5e9286a7ea5c6f0977595c37f11087f5883.tar.gz
gdb-fb58f5e9286a7ea5c6f0977595c37f11087f5883.tar.bz2
Fix a potential use of an uninitialised variable error in gold.
* target-reloc.h (issue_discarded_error): Initialise the key_symndx variable.
-rw-r--r--gold/ChangeLog5
-rw-r--r--gold/target-reloc.h2
2 files changed, 6 insertions, 1 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 4d524d7..78b5579 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,8 @@
+2020-06-24 Nick Clifton <nickc@redhat.com>
+
+ * target-reloc.h (issue_discarded_error): Initialise the
+ key_symndx variable.
+
2020-06-23 Roland McGrath <mcgrathr@google.com>
PR 22843
diff --git a/gold/target-reloc.h b/gold/target-reloc.h
index 2b205a1..e9e3e5b 100644
--- a/gold/target-reloc.h
+++ b/gold/target-reloc.h
@@ -258,7 +258,7 @@ issue_discarded_error(
&is_ordinary);
if (orig_shndx != elfcpp::SHN_UNDEF)
{
- unsigned int key_symndx;
+ unsigned int key_symndx = 0;
Relobj* kept_obj = object->find_kept_section_object(orig_shndx,
&key_symndx);
if (key_symndx != 0)