svn commit: r336521 - stable/11/contrib/elftoolchain/elfcopy

Mark Johnston markj at FreeBSD.org
Thu Jul 19 22:45:15 UTC 2018


Author: markj
Date: Thu Jul 19 22:45:13 2018
New Revision: 336521
URL: https://svnweb.freebsd.org/changeset/base/336521

Log:
  MFC r336226:
  Pass the right sizes to malloc() and realloc().

Modified:
  stable/11/contrib/elftoolchain/elfcopy/sections.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/elftoolchain/elfcopy/sections.c
==============================================================================
--- stable/11/contrib/elftoolchain/elfcopy/sections.c	Thu Jul 19 21:59:52 2018	(r336520)
+++ stable/11/contrib/elftoolchain/elfcopy/sections.c	Thu Jul 19 22:45:13 2018	(r336521)
@@ -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;			\


More information about the svn-src-stable mailing list