summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@cvs.openbsd.org>2008-09-10 15:00:02 +0000
committerTobias Stoeckmann <tobias@cvs.openbsd.org>2008-09-10 15:00:02 +0000
commit9fa9775915df1929a921491a76375ec0e7407ec6 (patch)
treed0689c2426bb4f0cfadfdb559be225dc81a53bdf /usr.sbin
parente7b0d8d85d6981b8ab4a1c342c051fc90308eb42 (diff)
Properly free allocated memory if carp_demote_get encounters an error.
ok henning@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bgpd/carp.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.sbin/bgpd/carp.c b/usr.sbin/bgpd/carp.c
index 69d3082b341..655a30df127 100644
--- a/usr.sbin/bgpd/carp.c
+++ b/usr.sbin/bgpd/carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: carp.c,v 1.5 2007/04/23 14:52:28 claudio Exp $ */
+/* $OpenBSD: carp.c,v 1.6 2008/09/10 15:00:01 tobias 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;