diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2008-02-26 20:06:15 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2008-02-26 20:06:15 +0000 |
commit | 428d5bffb0753c255bd3a6e7451b227979e281ec (patch) | |
tree | 946efe505b82e0aecdcd7cc61645553b7dcf8cb6 /usr.sbin/snmpd | |
parent | 55b753d4100ad25cb971f4fcb390862a876717a2 (diff) |
Fix memory leak in the parser. Found by Matthew Dempsky but using the more
common way to clear the TAILQ. OK thib@
Diffstat (limited to 'usr.sbin/snmpd')
-rw-r--r-- | usr.sbin/snmpd/parse.y | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.sbin/snmpd/parse.y b/usr.sbin/snmpd/parse.y index 75f03ec1e06..601ebdbcb66 100644 --- a/usr.sbin/snmpd/parse.y +++ b/usr.sbin/snmpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.11 2008/01/30 10:12:45 reyk Exp $ */ +/* $OpenBSD: parse.y,v 1.12 2008/02/26 20:06:14 claudio Exp $ */ /* * Copyright (c) 2007, 2008 Reyk Floeter <reyk@vantronix.net> @@ -170,6 +170,11 @@ main : LISTEN ON STRING { h = TAILQ_FIRST(&al); bcopy(&h->ss, &conf->sc_address.ss, sizeof(*h)); conf->sc_address.port = h->port; + + while ((h = TAILQ_FIRST(&al)) != NULL) { + TAILQ_REMOVE(&al, h, entry); + free(h); + } } | READONLY COMMUNITY STRING { if (strlcpy(conf->sc_rdcommunity, $3, |