mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 07:37:29 +00:00
lib: fix oper-state memleak
Fix memleak when a key-ed query was done for which the key didn't exist. Signed-off-by: Christian Hopps <chopps@labn.net>
This commit is contained in:
parent
ea9d2b82c7
commit
5519c0fbe6
@ -477,7 +477,7 @@ static enum nb_error nb_op_ys_init_node_infos(struct nb_op_yield_state *ys)
|
|||||||
{
|
{
|
||||||
struct nb_op_node_info *ni;
|
struct nb_op_node_info *ni;
|
||||||
struct lyd_node_inner *inner;
|
struct lyd_node_inner *inner;
|
||||||
struct lyd_node *node;
|
struct lyd_node *node = NULL;
|
||||||
enum nb_error ret;
|
enum nb_error ret;
|
||||||
uint i, len;
|
uint i, len;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
@ -547,6 +547,8 @@ static enum nb_error nb_op_ys_init_node_infos(struct nb_op_yield_state *ys)
|
|||||||
darr_foreach_i (ys->node_infos, i) {
|
darr_foreach_i (ys->node_infos, i) {
|
||||||
ret = nb_op_ys_finalize_node_info(ys, i);
|
ret = nb_op_ys_finalize_node_info(ys, i);
|
||||||
if (ret != NB_OK) {
|
if (ret != NB_OK) {
|
||||||
|
if (ys->node_infos[0].inner)
|
||||||
|
lyd_free_all(&ys->node_infos[0].inner->node);
|
||||||
darr_free(ys->node_infos);
|
darr_free(ys->node_infos);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -92,6 +92,12 @@ def test_oper_simple(tgen):
|
|||||||
'rib[afi-safi-name="frr-routing:ipv4-unicast"][table-id="254"]/route',
|
'rib[afi-safi-name="frr-routing:ipv4-unicast"][table-id="254"]/route',
|
||||||
"simple-results/result-ribs-rib-route-nokey.json",
|
"simple-results/result-ribs-rib-route-nokey.json",
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
'/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",
|
||||||
|
),
|
||||||
# Missing entry
|
# Missing entry
|
||||||
(
|
(
|
||||||
'/frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/'
|
'/frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/'
|
||||||
@ -99,12 +105,6 @@ def test_oper_simple(tgen):
|
|||||||
'route[prefix="1.1.0.0/24"]',
|
'route[prefix="1.1.0.0/24"]',
|
||||||
"simple-results/result-empty.json",
|
"simple-results/result-empty.json",
|
||||||
),
|
),
|
||||||
(
|
|
||||||
'/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",
|
|
||||||
),
|
|
||||||
# Leaf reference
|
# Leaf reference
|
||||||
(
|
(
|
||||||
'/frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/'
|
'/frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/'
|
||||||
|
Loading…
Reference in New Issue
Block a user