diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2013-03-14 14:53:53 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2013-03-14 14:53:53 +0000 |
commit | afbb31f242f1101fb90a902e3fde56b79c5bd72d (patch) | |
tree | a227ae6020c68601a1e3c7de20de3539e0313c23 /usr.sbin/bgpd/kroute.c | |
parent | 56e8def07b63f70c5585750833d829a28a59b107 (diff) |
use after free; 33% found by llvm
OK sthen@
Diffstat (limited to 'usr.sbin/bgpd/kroute.c')
-rw-r--r-- | usr.sbin/bgpd/kroute.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/usr.sbin/bgpd/kroute.c b/usr.sbin/bgpd/kroute.c index 7fdf98dc40e..b842575d1ea 100644 --- a/usr.sbin/bgpd/kroute.c +++ b/usr.sbin/bgpd/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.191 2012/11/13 22:07:28 florian Exp $ */ +/* $OpenBSD: kroute.c,v 1.192 2013/03/14 14:53:52 florian Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -506,8 +506,10 @@ kr4_change(struct ktable *kt, struct kroute_full *kl) kr->r.priority = RTP_BGP; kr->r.labelid = labelid; - if (kroute_insert(kt, kr) == -1) + if (kroute_insert(kt, kr) == -1) { free(kr); + return (-1); + } } else { kr->r.nexthop.s_addr = kl->nexthop.v4.s_addr; rtlabel_unref(kr->r.labelid); @@ -563,8 +565,10 @@ kr6_change(struct ktable *kt, struct kroute_full *kl) kr6->r.priority = RTP_BGP; kr6->r.labelid = labelid; - if (kroute6_insert(kt, kr6) == -1) + if (kroute6_insert(kt, kr6) == -1) { free(kr6); + return (-1); + } } else { memcpy(&kr6->r.nexthop, &kl->nexthop.v6, sizeof(struct in6_addr)); @@ -633,8 +637,10 @@ krVPN4_change(struct ktable *kt, struct kroute_full *kl) kr->r.labelid = labelid; kr->r.mplslabel = mplslabel; - if (kroute_insert(kt, kr) == -1) + if (kroute_insert(kt, kr) == -1) { free(kr); + return (-1); + } } else { kr->r.mplslabel = mplslabel; kr->r.nexthop.s_addr = kl->nexthop.v4.s_addr; |