diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-04-13 21:16:23 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-04-13 21:16:23 +0000 |
commit | 6002ef089c09188d3802adcc12fc5362c4427649 (patch) | |
tree | 09c2e94d56fa32122aaf82fdcfa18ed7d14ef99c /usr.sbin/bgpd | |
parent | d0ce38bc9b74fae350509cf7e5be7fe308e49204 (diff) |
filter_set cleanup. Plug some memleaks and fix an obvious bug in the
network case. OK henning@
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r-- | usr.sbin/bgpd/parse.y | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index a2d47a30084..ea65f2c9053 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.158 2005/04/12 14:32:00 claudio Exp $ */ +/* $OpenBSD: parse.y,v 1.159 2005/04/13 21:16:22 claudio Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -334,8 +334,12 @@ conf_main : AS asnumber { memcpy(&n->net.prefix, &$2.prefix, sizeof(n->net.prefix)); n->net.prefixlen = $2.len; - memcpy(&n->net.attrset, &$3, - sizeof(n->net.attrset)); + if ($3 == NULL || SIMPLEQ_EMPTY($3)) + SIMPLEQ_INIT(&n->net.attrset); + else + memcpy(&n->net.attrset, $3, + sizeof(n->net.attrset)); + free($3); TAILQ_INSERT_TAIL(netconf, n, entry); } @@ -2040,6 +2044,7 @@ expand_rule(struct filter_rule *rule, struct filter_peers_l *peer, struct filter_peers_l *p, *pnext; struct filter_prefix_l *prefix, *prefix_next; struct filter_as_l *a, *anext; + struct filter_set *s; p = peer; do { @@ -2099,6 +2104,13 @@ expand_rule(struct filter_rule *rule, struct filter_peers_l *peer, anext = a->next; free(a); } + + while ((s = SIMPLEQ_FIRST(set)) != NULL) { + SIMPLEQ_REMOVE_HEAD(set, entry); + free(s); + } + free(set); + return (0); } |