mirror of
https://github.com/bgp/bgpq4
synced 2025-02-28 08:53:11 +00:00
Reduce memory usage
This commit is contained in:
9
CHANGES
9
CHANGES
@@ -1,10 +1,11 @@
|
||||
1.3 (2021-XX-XX)
|
||||
- Change versioning from X.Y.Z to Y.Z
|
||||
- the repository file hierachy has been reorganized (compat/ include/)
|
||||
- man page has been extended
|
||||
- large portions of code have been reformatted to adhere to OpenBSD's source
|
||||
- The repository file hierachy has been reorganized (compat/ include/)
|
||||
- Man page has been extended
|
||||
- Large portions of code have been reformatted to adhere to OpenBSD's source
|
||||
file style guide to improve readability.
|
||||
- refactor: replace two-dimensional array for ASN storage with Red-Black tree
|
||||
- Refactor: replace two-dimensional array for ASN storage with Red-Black tree
|
||||
- Reduced memory usage
|
||||
|
||||
0.0.9 (2021-08-18)
|
||||
- Fix various memory errors
|
||||
|
||||
13
expander.c
13
expander.c
@@ -446,7 +446,7 @@ bgpq_expander_invalidate_asn(struct bgpq_expander *b, const char *q)
|
||||
sx_report(SX_ERROR, "overflow: %s\n", q);
|
||||
return;
|
||||
}
|
||||
if (asn >= 4294967295) {
|
||||
if (asn == 0 || asn >= 4294967295) {
|
||||
sx_report(SX_ERROR, "out of range: %s\n", q);
|
||||
return;
|
||||
}
|
||||
@@ -456,15 +456,10 @@ bgpq_expander_invalidate_asn(struct bgpq_expander *b, const char *q)
|
||||
}
|
||||
|
||||
find.asn = asn;
|
||||
res = RB_FIND(asn_tree, &b->asnlist, &find);
|
||||
if (res == NULL)
|
||||
return;
|
||||
|
||||
if (RB_REMOVE(asn_tree, &b->asnlist, res) == NULL) {
|
||||
sx_report(SX_ERROR, "failed to remove: %lu", asn);
|
||||
return;
|
||||
if ((res = RB_FIND(asn_tree, &b->asnlist, &find)) == NULL) {
|
||||
RB_REMOVE(asn_tree, &b->asnlist, res);
|
||||
free(res);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user