diff options
author | 2003-12-25 17:58:50 +0000 | |
---|---|---|
committer | 2003-12-25 17:58:50 +0000 | |
commit | 2644419ddb4bbcdc5133b4273edda353f42f33e1 (patch) | |
tree | 58b2148e5acae9c32a59fb8f12d55b530f195dc6 | |
parent | Update to libiberty from binutils-2.14 (diff) | |
download | wireguard-openbsd-2644419ddb4bbcdc5133b4273edda353f42f33e1.tar.xz wireguard-openbsd-2644419ddb4bbcdc5133b4273edda353f42f33e1.zip |
o can't TAILQ_FOREACH when we TAILQ_REMOVE in the loop
o free(sym)
-rw-r--r-- | usr.sbin/bgpd/parse.y | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index f2a4c5d7d23..76b4cb9fbe7 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.14 2003/12/25 17:35:53 henning Exp $ */ +/* $OpenBSD: parse.y,v 1.15 2003/12/25 17:58:50 henning Exp $ */ /* * Copyright (c) 2002, 2003 Henning Brauer <henning@openbsd.org> @@ -530,7 +530,7 @@ int parse_config(char *filename, struct bgpd_config *xconf, struct mrt_config *xmconf) { - struct sym *sym; + struct sym *sym, *next; if ((conf = calloc(1, sizeof(struct bgpd_config))) == NULL) fatal(NULL, errno); @@ -562,13 +562,15 @@ parse_config(char *filename, struct bgpd_config *xconf, yyparse(); /* Free macros and check which have not been used. */ - TAILQ_FOREACH(sym, &symhead, entries) { + for(sym = TAILQ_FIRST(&symhead); sym != NULL; sym = next) { + next = TAILQ_NEXT(sym, entries); if ((conf->opts & BGPD_OPT_VERBOSE2) && !sym->used) fprintf(stderr, "warning: macro '%s' not " "used\n", sym->nam); free(sym->nam); free(sym->val); TAILQ_REMOVE(&symhead, sym, entries); + free(sym); } errors += merge_config(xconf, conf); |