1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-24 07:40:52 +00:00

fib_dxr: do not leak memory if FIB constellation hits structural limit

DXR lookup table encoding has an inherent structural limit on the amount
of binary search ranges it can accomodate.  With the current IPv4 BGP views
(circa 1 M prefixes) and default DXR encoding we are only at around 5% of
that limit, so far, far away from hitting it.  Just in case it ever gets
hit, make sure we free the allocated structures, instead of leaking it.

MFC after:	1 week
This commit is contained in:
Marko Zec 2024-05-17 18:36:21 +02:00
parent e9806d2128
commit 19bd24caa4

View File

@ -1320,8 +1320,10 @@ dxr_change_rib_batch(struct rib_head *rnh, struct fib_change_queue *q,
dxr_build(new_dxr);
/* Structural limit exceeded, hard error */
if (da->rtbl_top >= BASE_MAX)
if (da->rtbl_top >= BASE_MAX) {
dxr_destroy(new_dxr);
return (FLM_ERROR);
}
if (new_dxr->d == NULL) {
dxr_destroy(new_dxr);