aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Nilsson <brainbomb@gmail.com>2022-06-22 10:36:03 +0200
committerJan Beulich <jbeulich@suse.com>2022-06-22 10:36:03 +0200
commit4491a7c1aa356887a783c451a5e6cc708112b483 (patch)
tree4a13c268d4b2fa03b665c658a56e0f037312b4ba
parent46439c90f2000edcb300c85ed843f8930752aed5 (diff)
downloadgdb-4491a7c1aa356887a783c451a5e6cc708112b483.zip
gdb-4491a7c1aa356887a783c451a5e6cc708112b483.tar.gz
gdb-4491a7c1aa356887a783c451a5e6cc708112b483.tar.bz2
readelf: replace xmalloc with malloc in slurp_relr_relocs
Using xmalloc makes the null check redundant since failing allocation will exit the program. Instead use malloc and let the error be conveyed up the call chain.
-rw-r--r--binutils/ChangeLog5
-rw-r--r--binutils/readelf.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 888d453..8ff4e05 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,8 @@
+2022-06-22 Marcus Nilsson <brainbomb@gmail.com>
+
+ * readelf.c: (slurp_relr_relocs) Use malloc instead of xmalloc
+ when allocating space for relocations.
+
2022-06-21 Kumar N, Bhuvanendra via Binutils <Kavitha.Natarajan@amd.com>
* dwarf.h (struct debug_info): Add rnglists_base field.
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 4c0a2a3..fe0d27d 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -1401,7 +1401,7 @@ slurp_relr_relocs (Filedata * filedata,
size++;
}
- *relrsp = (bfd_vma *) xmalloc (size * sizeof (bfd_vma));
+ *relrsp = (bfd_vma *) malloc (size * sizeof (bfd_vma));
if (*relrsp == NULL)
{
free (relrs);