diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-02-03 17:36:31 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-02-03 17:36:31 +0000 |
commit | ab1646f12bbbdd3cbd6d1ef6748d0840536d1f52 (patch) | |
tree | 595e3b8d812768c1c7e1dcfbcc9a8ea4914fae26 /usr.sbin/bgpd/parse.y | |
parent | a13d137c08a9e9b337b3baf4be3893558ac7723c (diff) |
defer free()ing the previous peer list until after parsing the config file
so in the parser we can access it. will be needed soon.
Diffstat (limited to 'usr.sbin/bgpd/parse.y')
-rw-r--r-- | usr.sbin/bgpd/parse.y | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index 71a3f3ae3b4..37f0e390f55 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.45 2004/02/01 19:46:05 claudio Exp $ */ +/* $OpenBSD: parse.y,v 1.46 2004/02/03 17:36:30 henning Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -40,7 +40,7 @@ static struct bgpd_config *conf; static struct mrt_head *mrtconf; static struct network_head *netconf; -static struct peer *peer_l; +static struct peer *peer_l, *peer_l_old; static struct peer *curpeer; static struct peer *curgroup; static FILE *fin = NULL; @@ -652,6 +652,7 @@ parse_config(char *filename, struct bgpd_config *xconf, struct mrt_head *xmconf, struct peer **xpeers, struct network_head* nc) { struct sym *sym, *next; + struct peer *p, *pnext; if ((conf = calloc(1, sizeof(struct bgpd_config))) == NULL) fatal(NULL); @@ -662,6 +663,7 @@ parse_config(char *filename, struct bgpd_config *xconf, TAILQ_INIT(netconf); peer_l = NULL; + peer_l_old = *xpeers; curpeer = NULL; curgroup = NULL; lineno = 1; @@ -702,6 +704,11 @@ parse_config(char *filename, struct bgpd_config *xconf, errors += mrt_mergeconfig(xmconf, mrtconf); *xpeers = peer_l; + for (p = peer_l_old; p != NULL; p = pnext) { + pnext = p->next; + free(p); + } + free(conf); free(mrtconf); |