From 966599e8469056afebfe392b5145ca9abde9ab92 Mon Sep 17 00:00:00 2001 From: Henning Brauer Date: Thu, 16 Sep 2004 01:10:06 +0000 Subject: in imsg_compose: -don't buf_free() on imsg_add() errors, it already does that for us -use imsg_close() instead of buf_close(), does error handling already --- usr.sbin/ntpd/imsg.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'usr.sbin/ntpd') diff --git a/usr.sbin/ntpd/imsg.c b/usr.sbin/ntpd/imsg.c index 8d0c0a28d78..73b1e273e93 100644 --- a/usr.sbin/ntpd/imsg.c +++ b/usr.sbin/ntpd/imsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.c,v 1.5 2004/09/16 01:06:51 henning Exp $ */ +/* $OpenBSD: imsg.c,v 1.6 2004/09/16 01:10:05 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -101,16 +101,12 @@ imsg_compose(struct imsgbuf *ibuf, int type, u_int32_t peerid, pid_t pid, if ((wbuf = imsg_create(ibuf, type, peerid, pid, datalen)) == NULL) return (-1); - if (imsg_add(wbuf, data, datalen) == -1) { - buf_free(wbuf); + if (imsg_add(wbuf, data, datalen) == -1) + return (-1); + + if ((n = imsg_close(ibuf, wbuf)) < 0) return (-1); - } - if ((n = buf_close(&ibuf->w, wbuf)) < 0) { - log_warnx("imsg_compose: buf_add error"); - buf_free(wbuf); - return (-1); - } return (n); } -- cgit v1.2.3