mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-08 13:28:05 +00:00
Pass the right sizes to malloc() and realloc().
Reported by: scan-build, via Mark Millard MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D16180
This commit is contained in:
parent
ca0a66ba34
commit
b027d6545b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=336226
@ -716,13 +716,13 @@ filter_reloc(struct elfcopy *ecp, struct section *s)
|
||||
#define COPYREL(REL, SZ) do { \
|
||||
if (nrels == 0) { \
|
||||
if ((REL##SZ = malloc(cap * \
|
||||
sizeof(Elf##SZ##_Rel))) == NULL) \
|
||||
sizeof(*REL##SZ))) == NULL) \
|
||||
err(EXIT_FAILURE, "malloc failed"); \
|
||||
} \
|
||||
if (nrels >= cap) { \
|
||||
cap *= 2; \
|
||||
if ((REL##SZ = realloc(REL##SZ, cap * \
|
||||
sizeof(Elf##SZ##_Rel))) == NULL) \
|
||||
sizeof(*REL##SZ))) == NULL) \
|
||||
err(EXIT_FAILURE, "realloc failed"); \
|
||||
} \
|
||||
REL##SZ[nrels].r_offset = REL.r_offset; \
|
||||
|
Loading…
Reference in New Issue
Block a user