-/* $OpenBSD: smtpctl.c,v 1.125 2015/01/20 17:37:54 deraadt Exp $ */
+/* $OpenBSD: smtpctl.c,v 1.126 2015/10/06 05:48:34 gilles Exp $ */
/*
* Copyright (c) 2013 Eric Faurot <eric@openbsd.org>
static int
srv_iter_evpids(uint32_t msgid, uint64_t *evpid, int *offset)
{
- static uint64_t *evpids = NULL;
+ static uint64_t *evpids = NULL, *tmp;
static int n, alloc = 0;
struct envelope evp;
while (srv_iter_envelopes(msgid, &evp)) {
if (n == alloc) {
alloc += 256;
- evpids = reallocarray(evpids, alloc,
+ tmp = reallocarray(evpids, alloc,
sizeof(*evpids));
- if (evpids == NULL)
+ if (tmp == NULL)
err(1, "reallocarray");
+ evpids = tmp;
}
evpids[n++] = evp.id;
}
-/* $OpenBSD: util.c,v 1.116 2015/10/05 22:08:14 stsp Exp $ */
+/* $OpenBSD: util.c,v 1.117 2015/10/06 05:48:34 gilles Exp $ */
/*
* Copyright (c) 2000,2001 Markus Friedl. All rights reserved.
char *cp;
uint nalloc;
int r;
+ char **tmp;
va_start(ap, fmt);
r = vasprintf(&cp, fmt, ap);
} else if (args->num+2 >= nalloc)
nalloc *= 2;
- args->list = reallocarray(args->list, nalloc, sizeof(char *));
- if (args->list == NULL)
+ tmp = reallocarray(args->list, nalloc, sizeof(char *));
+ if (tmp == NULL)
fatal("addargs: reallocarray");
+ args->list = tmp;
args->nalloc = nalloc;
args->list[args->num++] = cp;
args->list[args->num] = NULL;