readelf: Fix the check for an error from realloc().

Use err() instead of errx() while here, since realloc() sets errno.

CID:		1401326
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Mark Johnston 2020-02-04 21:18:37 +00:00
parent dfa169049b
commit 37fa1df2d1

View File

@ -6298,8 +6298,8 @@ search_loclist_at(struct readelf *re, Dwarf_Die die, Dwarf_Unsigned lowpc,
if (*la_list_cap == *la_list_len) {
*la_list = realloc(*la_list,
*la_list_cap * 2 * sizeof(**la_list));
if (la_list == NULL)
errx(EXIT_FAILURE, "realloc failed");
if (*la_list == NULL)
err(EXIT_FAILURE, "realloc failed");
*la_list_cap *= 2;
}
la = &((*la_list)[*la_list_len]);