summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pmcstat/pmcstat_log.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/pmcstat/pmcstat_log.c')
-rw-r--r--usr.sbin/pmcstat/pmcstat_log.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/pmcstat/pmcstat_log.c b/usr.sbin/pmcstat/pmcstat_log.c
index 26f3615..aaca292 100644
--- a/usr.sbin/pmcstat/pmcstat_log.c
+++ b/usr.sbin/pmcstat/pmcstat_log.c
@@ -535,8 +535,8 @@ pmcstat_image_add_symbols(struct pmcstat_image *image, Elf *e,
* Allocate space for the new entries.
*/
firsttime = image->pi_symbols == NULL;
- symptr = realloc(image->pi_symbols,
- sizeof(*symptr) * (image->pi_symcount + nfuncsyms));
+ symptr = reallocarray(image->pi_symbols,
+ image->pi_symcount + nfuncsyms, sizeof(*symptr));
if (symptr == image->pi_symbols) /* realloc() failed. */
return;
image->pi_symbols = symptr;
@@ -587,8 +587,8 @@ pmcstat_image_add_symbols(struct pmcstat_image *image, Elf *e,
* Return space to the system if there were duplicates.
*/
if (newsyms < nfuncsyms)
- image->pi_symbols = realloc(image->pi_symbols,
- sizeof(*symptr) * image->pi_symcount);
+ image->pi_symbols = reallocarray(image->pi_symbols,
+ image->pi_symcount, sizeof(*symptr));
/*
* Keep the list of symbols sorted.
OpenPOWER on IntegriCloud