summaryrefslogtreecommitdiff
path: root/src/readelf.c
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2021-09-06 10:00:00 +0000
committerDmitry V. Levin <ldv@altlinux.org>2021-09-09 08:03:00 +0000
commitc1a67b39611f3e396121cf5333b0e77b537e9741 (patch)
tree1ac3dcfd8b06daa0f1c93732b960af1813ca35db /src/readelf.c
parent5df759af555e6ffc385ead7683bcbd059a698944 (diff)
downloadelfutils-c1a67b39611f3e396121cf5333b0e77b537e9741.tar.gz
Use xasprintf instead of asprintf followed by error(EXIT_FAILURE)
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Diffstat (limited to 'src/readelf.c')
-rw-r--r--src/readelf.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/readelf.c b/src/readelf.c
index 1e3ad43d..3a199068 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -3448,17 +3448,15 @@ handle_gnu_hash (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr, size_t shstrndx)
nbits += (word & 0x0000ffff) + ((word >> 16) & 0x0000ffff);
}
- char *str;
- if (unlikely (asprintf (&str, _("\
+ char *str = xasprintf (_("\
Symbol Bias: %u\n\
Bitmask Size: %zu bytes %" PRIuFAST32 "%% bits set 2nd hash shift: %u\n"),
- (unsigned int) symbias,
- bitmask_words * sizeof (Elf32_Word),
- ((nbits * 100 + 50)
- / (uint_fast32_t) (bitmask_words
+ (unsigned int) symbias,
+ bitmask_words * sizeof (Elf32_Word),
+ ((nbits * 100 + 50)
+ / (uint_fast32_t) (bitmask_words
* sizeof (Elf32_Word) * 8)),
- (unsigned int) shift) == -1))
- error (EXIT_FAILURE, 0, _("memory exhausted"));
+ (unsigned int) shift);
print_hash_info (ebl, scn, shdr, shstrndx, maxlength, nbucket, nsyms,
lengths, str);