From: Marcus Nilsson Date: Wed, 22 Jun 2022 08:36:03 +0000 (+0200) Subject: readelf: replace xmalloc with malloc in slurp_relr_relocs X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4491a7c1aa356887a783c451a5e6cc708112b483;p=binutils-gdb.git 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. --- diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 888d453321b..8ff4e059bf9 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2022-06-22 Marcus Nilsson + + * readelf.c: (slurp_relr_relocs) Use malloc instead of xmalloc + when allocating space for relocations. + 2022-06-21 Kumar N, Bhuvanendra via Binutils * dwarf.h (struct debug_info): Add rnglists_base field. diff --git a/binutils/readelf.c b/binutils/readelf.c index 4c0a2a34767..fe0d27decc3 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);