summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/mfa.c
diff options
context:
space:
mode:
authorCharles Longeau <chl@cvs.openbsd.org>2012-09-27 17:58:57 +0000
committerCharles Longeau <chl@cvs.openbsd.org>2012-09-27 17:58:57 +0000
commitbad24a20111a04542ef10df25e711086eeee0039 (patch)
tree7eb665de8ee2e6ab3b99ee7311a92266758d8bcf /usr.sbin/smtpd/mfa.c
parent81aae5e403320a67be478330dac28a4b677cf737 (diff)
simplify calloc() + strlcpy()/memcpy() dance with xmemdup()
use xcalloc() helper remove newly unused variable ok gilles@ eric@
Diffstat (limited to 'usr.sbin/smtpd/mfa.c')
-rw-r--r--usr.sbin/smtpd/mfa.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/usr.sbin/smtpd/mfa.c b/usr.sbin/smtpd/mfa.c
index 667e333a119..98caa1580c9 100644
--- a/usr.sbin/smtpd/mfa.c
+++ b/usr.sbin/smtpd/mfa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mfa.c,v 1.69 2012/09/19 19:40:36 eric Exp $ */
+/* $OpenBSD: mfa.c,v 1.70 2012/09/27 17:58:56 chl Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -106,17 +106,13 @@ mfa_imsg(struct imsgev *iev, struct imsg *imsg)
if (iev->proc == PROC_PARENT) {
switch (imsg->hdr.type) {
case IMSG_CONF_START:
- env->sc_filters = calloc(1, sizeof *env->sc_filters);
- if (env->sc_filters == NULL)
- fatal(NULL);
+ env->sc_filters = xcalloc(1, sizeof *env->sc_filters,
+ "mfa_imsg");
TAILQ_INIT(env->sc_filters);
return;
case IMSG_CONF_FILTER:
- filter = calloc(1, sizeof *filter);
- if (filter == NULL)
- fatal(NULL);
- memcpy(filter, (struct filter *)imsg->data, sizeof (*filter));
+ filter = xmemdup(imsg->data, sizeof *filter, "mfa_imsg");
TAILQ_INSERT_TAIL(env->sc_filters, filter, f_entry);
return;