summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-06-08 20:14:57 +0200
committerGitHub <noreply@github.com>2018-06-08 20:14:57 +0200
commit53c6a643ae7bea79ead75452d32707f0aa8ee235 (patch)
tree108607b41c33b52fc6fe6f91039d3ffcd96c6b06
parentMerge pull request #2386 from gromit1811/pim-connected-nexthop-fix2 (diff)
parentzebra: resource leak fix (Coverity 1465679) (diff)
downloadfrr-53c6a643ae7bea79ead75452d32707f0aa8ee235.tar.xz
frr-53c6a643ae7bea79ead75452d32707f0aa8ee235.zip
Merge pull request #2387 from pacovn/Coverity_1465679_Resource_leak
zebra: resource leak fix (Coverity 1465679)
-rw-r--r--zebra/zebra_vty.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index eb11941a3..9ce8c7422 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -260,18 +260,22 @@ static int zebra_static_route_holdem(
return CMD_SUCCESS;
}
- XFREE(MTYPE_STATIC_ROUTE, shr->nhvrf_name);
- XFREE(MTYPE_STATIC_ROUTE, shr->vrf_name);
- XFREE(MTYPE_STATIC_ROUTE, shr);
/*
* If a person enters the same line again
* we need to silently accept it
*/
- return CMD_SUCCESS;
+ goto shr_cleanup;
}
- if (!negate)
+ if (!negate) {
listnode_add_sort(static_list, shr);
+ return CMD_SUCCESS;
+ }
+
+shr_cleanup:
+ XFREE(MTYPE_STATIC_ROUTE, shr->nhvrf_name);
+ XFREE(MTYPE_STATIC_ROUTE, shr->vrf_name);
+ XFREE(MTYPE_STATIC_ROUTE, shr);
return CMD_SUCCESS;
}