summaryrefslogtreecommitdiff
path: root/usr.sbin/relayd/carp.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2016-08-18 00:45:53 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2016-08-18 00:45:53 +0000
commitd3ae3ce9cbd2ecbada8b1187de340c869534a873 (patch)
treef787c312eaf58fd57c4b8081ba92a9070bcbe804 /usr.sbin/relayd/carp.c
parent2051d8823042ac60355bec06dd9922dfde7153b4 (diff)
fix fd leaks in error paths
ok reyk@
Diffstat (limited to 'usr.sbin/relayd/carp.c')
-rw-r--r--usr.sbin/relayd/carp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.sbin/relayd/carp.c b/usr.sbin/relayd/carp.c
index 09708aa7dbf..6a6a55a0fbb 100644
--- a/usr.sbin/relayd/carp.c
+++ b/usr.sbin/relayd/carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: carp.c,v 1.11 2015/01/22 17:42:09 reyk Exp $ */
+/* $OpenBSD: carp.c,v 1.12 2016/08/18 00:45:52 jsg Exp $ */
/*
* Copyright (c) 2006 Henning Brauer <henning@openbsd.org>
@@ -117,6 +117,7 @@ carp_demote_get(char *group)
if (strlcpy(ifgr.ifgr_name, group, sizeof(ifgr.ifgr_name)) >=
sizeof(ifgr.ifgr_name)) {
log_warn("%s: invalid group", __func__);
+ close(s);
return (-1);
}
@@ -201,6 +202,7 @@ carp_demote_ioctl(char *group, int demote)
if (strlcpy(ifgr.ifgr_name, group, sizeof(ifgr.ifgr_name)) >=
sizeof(ifgr.ifgr_name)) {
log_warn("%s: invalid group", __func__);
+ close(s);
return (-1);
}
ifgr.ifgr_attrib.ifg_carp_demoted = demote;