summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2009-09-30 12:22:04 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2009-09-30 12:22:04 +0000
commit36c2434b55ecb6abd270a0635ff883a78b8437d9 (patch)
tree7614a357a8fadb83e2f53dff395f93a2bf70200c /usr.sbin
parent071eee905e5c1bb03637cbd908ebc5d798b24360 (diff)
Bring in sync with the bgpd version of carp.c. This fixes a memory leak
in an error path.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ospf6d/carp.c7
-rw-r--r--usr.sbin/ospfd/carp.c7
-rw-r--r--usr.sbin/relayd/carp.c7
-rw-r--r--usr.sbin/ripd/carp.c7
4 files changed, 20 insertions, 8 deletions
diff --git a/usr.sbin/ospf6d/carp.c b/usr.sbin/ospf6d/carp.c
index d60ca911a58..41dbe698adf 100644
--- a/usr.sbin/ospf6d/carp.c
+++ b/usr.sbin/ospf6d/carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: carp.c,v 1.2 2009/09/30 12:02:18 claudio Exp $ */
+/* $OpenBSD: carp.c,v 1.3 2009/09/30 12:22:03 claudio Exp $ */
/*
* Copyright (c) 2006 Henning Brauer <henning@openbsd.org>
@@ -72,8 +72,11 @@ carp_demote_init(char *group, int force)
}
/* only demote if this group already is demoted */
- if ((level = carp_demote_get(group)) == -1)
+ if ((level = carp_demote_get(group)) == -1) {
+ free(c->group);
+ free(c);
return (-1);
+ }
if (level > 0 || force)
c->do_demote = 1;
diff --git a/usr.sbin/ospfd/carp.c b/usr.sbin/ospfd/carp.c
index d2d4c5041d7..f3176952809 100644
--- a/usr.sbin/ospfd/carp.c
+++ b/usr.sbin/ospfd/carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: carp.c,v 1.2 2009/09/30 11:59:39 claudio Exp $ */
+/* $OpenBSD: carp.c,v 1.3 2009/09/30 12:22:03 claudio Exp $ */
/*
* Copyright (c) 2006 Henning Brauer <henning@openbsd.org>
@@ -72,8 +72,11 @@ carp_demote_init(char *group, int force)
}
/* only demote if this group already is demoted */
- if ((level = carp_demote_get(group)) == -1)
+ if ((level = carp_demote_get(group)) == -1) {
+ free(c->group);
+ free(c);
return (-1);
+ }
if (level > 0 || force)
c->do_demote = 1;
diff --git a/usr.sbin/relayd/carp.c b/usr.sbin/relayd/carp.c
index bcc1c7f8da4..b4de6936992 100644
--- a/usr.sbin/relayd/carp.c
+++ b/usr.sbin/relayd/carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: carp.c,v 1.6 2009/09/30 12:07:26 claudio Exp $ */
+/* $OpenBSD: carp.c,v 1.7 2009/09/30 12:22:03 claudio Exp $ */
/*
* Copyright (c) 2006 Henning Brauer <henning@openbsd.org>
@@ -75,8 +75,11 @@ carp_demote_init(char *group, int force)
}
/* only demote if this group already is demoted */
- if ((level = carp_demote_get(group)) == -1)
+ if ((level = carp_demote_get(group)) == -1) {
+ free(c->group);
+ free(c);
return (-1);
+ }
if (level > 0 || force)
c->do_demote = 1;
diff --git a/usr.sbin/ripd/carp.c b/usr.sbin/ripd/carp.c
index d94c940eca3..a1976fbac9f 100644
--- a/usr.sbin/ripd/carp.c
+++ b/usr.sbin/ripd/carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: carp.c,v 1.2 2009/09/30 12:08:52 claudio Exp $ */
+/* $OpenBSD: carp.c,v 1.3 2009/09/30 12:22:03 claudio Exp $ */
/*
* Copyright (c) 2006 Henning Brauer <henning@openbsd.org>
@@ -72,8 +72,11 @@ carp_demote_init(char *group, int force)
}
/* only demote if this group already is demoted */
- if ((level = carp_demote_get(group)) == -1)
+ if ((level = carp_demote_get(group)) == -1) {
+ free(c->group);
+ free(c);
return (-1);
+ }
if (level > 0 || force)
c->do_demote = 1;