diff options
author | Jacek Masiulaniec <jacekm@cvs.openbsd.org> | 2009-02-17 22:49:23 +0000 |
---|---|---|
committer | Jacek Masiulaniec <jacekm@cvs.openbsd.org> | 2009-02-17 22:49:23 +0000 |
commit | a867855445ba4c176695a9ea07d1916cb1c74157 (patch) | |
tree | 525d73fc55c2d85d02ea968ef619e20a0bda0cc6 | |
parent | 84a6f059873250e82f8264aeea18064e10fa1d12 (diff) |
imsg_init depends on ibuf being calloc'd. fix few places where malloc
is used instead; ok gilles@
Problem made visible by malloc.conf = AFGJ, and pointed out by otto@
-rw-r--r-- | usr.sbin/smtpd/control.c | 4 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpctl.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/smtpd/control.c b/usr.sbin/smtpd/control.c index d7ab5f12d6b..95c858550d5 100644 --- a/usr.sbin/smtpd/control.c +++ b/usr.sbin/smtpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.12 2009/02/15 10:32:23 jacekm Exp $ */ +/* $OpenBSD: control.c,v 1.13 2009/02/17 22:49:22 jacekm Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -221,7 +221,7 @@ control_accept(int listenfd, short event, void *arg) session_socket_blockmode(connfd, BM_NONBLOCK); - if ((c = malloc(sizeof(struct ctl_conn))) == NULL) { + if ((c = calloc(1, sizeof(struct ctl_conn))) == NULL) { close(connfd); log_warn("control_accept"); return; diff --git a/usr.sbin/smtpd/smtpctl.c b/usr.sbin/smtpd/smtpctl.c index 5faf4c81e05..be79ed772c4 100644 --- a/usr.sbin/smtpd/smtpctl.c +++ b/usr.sbin/smtpd/smtpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpctl.c,v 1.13 2009/02/13 20:44:46 jacekm Exp $ */ +/* $OpenBSD: smtpctl.c,v 1.14 2009/02/17 22:49:22 jacekm Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -133,7 +133,7 @@ connected: if (connect(ctl_sock, (struct sockaddr *)&sun, sizeof(sun)) == -1) err(1, "connect: %s", SMTPD_SOCKET); - if ((ibuf = malloc(sizeof(struct imsgbuf))) == NULL) + if ((ibuf = calloc(1, sizeof(struct imsgbuf))) == NULL) err(1, NULL); imsg_init(ibuf, ctl_sock, NULL); |