summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/parse.y
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2010-04-26 08:46:32 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2010-04-26 08:46:32 +0000
commit19b613f30bc55b25331d2f2f7ac8519250560b40 (patch)
tree66418b43ecb3f69521d7b5db839b436f6be9c316 /usr.sbin/bgpd/parse.y
parentcde3e380bfecc50fb439d29181799ca1bdc83cbd (diff)
Fix some memory leaks on config reload failure and move one particular
cleanup loop to parse.y where it belongs. OK henning@
Diffstat (limited to 'usr.sbin/bgpd/parse.y')
-rw-r--r--usr.sbin/bgpd/parse.y11
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y
index 0731a460a4e..1d9c7ee23c0 100644
--- a/usr.sbin/bgpd/parse.y
+++ b/usr.sbin/bgpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.250 2010/03/31 18:53:23 claudio Exp $ */
+/* $OpenBSD: parse.y,v 1.251 2010/04/26 08:46:31 claudio Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -2335,6 +2335,7 @@ parse_config(char *filename, struct bgpd_config *xconf,
struct listen_addr *la;
struct network *n;
struct filter_rule *r;
+ struct rde_rib *rr;
int errors = 0;
if ((conf = calloc(1, sizeof(struct bgpd_config))) == NULL)
@@ -2411,23 +2412,31 @@ parse_config(char *filename, struct bgpd_config *xconf,
while ((n = TAILQ_FIRST(netconf)) != NULL) {
TAILQ_REMOVE(netconf, n, entry);
+ filterset_free(&n->net.attrset);
free(n);
}
while ((r = TAILQ_FIRST(filter_l)) != NULL) {
TAILQ_REMOVE(filter_l, r, entry);
+ filterset_free(&r->set);
free(r);
}
while ((r = TAILQ_FIRST(peerfilter_l)) != NULL) {
TAILQ_REMOVE(peerfilter_l, r, entry);
+ filterset_free(&r->set);
free(r);
}
while ((r = TAILQ_FIRST(groupfilter_l)) != NULL) {
TAILQ_REMOVE(groupfilter_l, r, entry);
+ filterset_free(&r->set);
free(r);
}
+ while ((rr = SIMPLEQ_FIRST(&ribnames)) != NULL) {
+ SIMPLEQ_REMOVE_HEAD(&ribnames, entry);
+ free(rr);
+ }
} else {
errors += merge_config(xconf, conf, peer_l, listen_addrs);
errors += mrt_mergeconfig(xmconf, mrtconf);