diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2020-10-26 08:31:02 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2020-10-26 08:31:02 +0000 |
commit | 9bf1ade640cc4dd7ecf0dc20925a21131d9da4c8 (patch) | |
tree | f50d44b3d9e5e70766b7ab363be88e872356d570 | |
parent | f971cd201b2baeb7deb29578c55525634dc6a075 (diff) |
Fix a memory leak when parsing roa-set lists. If the prefixset_item is
already in the RB tree free the item we tried to add since the item form
the RB tree is used.
Memory leak found and fix provided by Felix Maurer ( felix at felix-maurer.de)
-rw-r--r-- | usr.sbin/bgpd/parse.y | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index 66f6eaad148..1c70b39eb3a 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.408 2020/05/10 13:38:46 deraadt Exp $ */ +/* $OpenBSD: parse.y,v 1.409 2020/10/26 08:31:01 claudio Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -4513,6 +4513,8 @@ add_roa_set(struct prefixset_item *npsi, u_int32_t as, u_int8_t max) psi = RB_INSERT(prefixset_tree, curpsitree, npsi); if (psi == NULL) psi = npsi; + else + free(npsi); if (psi->set == NULL) if ((psi->set = set_new(1, sizeof(rs))) == NULL) |