diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-04-30 17:34:06 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-04-30 17:34:06 +0000 |
commit | 8085ebe43e922476bdc4e3dd24a65ffdbe0a92cf (patch) | |
tree | 018c117dee4167d0bb8b6d52d8227b194501e669 /usr.sbin/bgpd/parse.y | |
parent | d3173820d6f8d6edb8c90109b7f101f858d729d0 (diff) |
plug memory leaks; henning ok
Diffstat (limited to 'usr.sbin/bgpd/parse.y')
-rw-r--r-- | usr.sbin/bgpd/parse.y | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index 460e659f8e6..7f9ad037a5d 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.98 2004/04/30 05:47:50 deraadt Exp $ */ +/* $OpenBSD: parse.y,v 1.99 2004/04/30 17:34:05 deraadt Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -826,19 +826,24 @@ filter_match : /* empty */ { bzero(&$$, sizeof($$)); } bzero(&$$, sizeof($$)); if ((p = strchr($2, ':')) == NULL) { + free($2); yyerror("Bad community syntax"); YYERROR; } *p++ = 0; - if ((i = getcommunity($2)) == COMMUNITY_ERROR) + if ((i = getcommunity($2)) == COMMUNITY_ERROR) { + free($2); YYERROR; + } + free($2); if (i == 0 || i == USHRT_MAX) { yyerror("Bad community as number"); YYERROR; } $$.community.as = i; - if ((i = getcommunity(p)) == COMMUNITY_ERROR) + if ((i = getcommunity(p)) == COMMUNITY_ERROR) { YYERROR; + } $$.community.type = i; } ; |