From: espie Date: Fri, 23 May 2014 13:28:32 +0000 (+0000) Subject: use reallocarray X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=362966cb49c6df535b7caa3f44eb146b4e2ec7fa;p=openbsd use reallocarray okay gilles@ --- diff --git a/usr.sbin/smtpd/smtpctl.c b/usr.sbin/smtpd/smtpctl.c index 0b42365be5c..f3c5cca8657 100644 --- a/usr.sbin/smtpd/smtpctl.c +++ b/usr.sbin/smtpd/smtpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpctl.c,v 1.120 2014/05/20 18:47:01 eric Exp $ */ +/* $OpenBSD: smtpctl.c,v 1.121 2014/05/23 13:28:32 espie Exp $ */ /* * Copyright (c) 2013 Eric Faurot @@ -317,9 +317,10 @@ srv_iter_evpids(uint32_t msgid, uint64_t *evpid, int *offset) while (srv_iter_envelopes(msgid, &evp)) { if (n == alloc) { alloc += 256; - evpids = realloc(evpids, alloc * sizeof(*evpids)); + evpids = reallocarray(evpids, alloc, + sizeof(*evpids)); if (evpids == NULL) - err(1, "realloc"); + err(1, "reallocarray"); } evpids[n++] = evp.id; }