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.
This commit is contained in:
Marcus Nilsson 2022-06-22 10:36:03 +02:00 committed by Jan Beulich
parent 46439c90f2
commit 4491a7c1aa
2 changed files with 6 additions and 1 deletions

View File

@ -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.

View File

@ -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);