Skip to content

Commit

Permalink
Merge pull request FRRouting#15123 from LabNConsulting/chopps/fix-ope…
Browse files Browse the repository at this point in the history
…r-state-memleak

lib: fix oper-state memleak
  • Loading branch information
ton31337 authored Jan 10, 2024
2 parents 22b4390 + 5519c0f commit 4c87548
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion lib/northbound_oper.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ static enum nb_error nb_op_ys_init_node_infos(struct nb_op_yield_state *ys)
{
struct nb_op_node_info *ni;
struct lyd_node_inner *inner;
struct lyd_node *node;
struct lyd_node *node = NULL;
enum nb_error ret;
uint i, len;
char *tmp;
Expand Down Expand Up @@ -550,6 +550,8 @@ static enum nb_error nb_op_ys_init_node_infos(struct nb_op_yield_state *ys)
darr_foreach_i (ys->node_infos, i) {
ret = nb_op_ys_finalize_node_info(ys, i);
if (ret != NB_OK) {
if (ys->node_infos[0].inner)
lyd_free_all(&ys->node_infos[0].inner->node);
darr_free(ys->node_infos);
return ret;
}
Expand Down
10 changes: 5 additions & 5 deletions tests/topotests/mgmt_oper/test_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,18 @@ def test_oper_simple(tgen):
'rib[afi-safi-name="frr-routing:ipv4-unicast"][table-id="254"]/route',
"simple-results/result-ribs-rib-route-nokey.json",
),
# Missing entry
(
'/frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/'
'rib[afi-safi-name="frr-routing:ipv4-unicast"][table-id="254"]/'
'route[prefix="1.1.0.0/24"]',
"simple-results/result-empty.json",
'route[prefix="1.1.1.0/24"]',
"simple-results/result-ribs-rib-route-prefix.json",
),
# Missing entry
(
'/frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/'
'rib[afi-safi-name="frr-routing:ipv4-unicast"][table-id="254"]/'
'route[prefix="1.1.1.0/24"]',
"simple-results/result-ribs-rib-route-prefix.json",
'route[prefix="1.1.0.0/24"]',
"simple-results/result-empty.json",
),
# Leaf reference
(
Expand Down

0 comments on commit 4c87548

Please sign in to comment.