isisd: address Coverity warnings
this fixes a bunch of issues found by Coverity SCAN and flagged as
"high" impact -- although, they're all rather minute issues.
* isisd/isis_adjacency.c: one superfluous check, one possible NULL deref
* isisd/isis_circuit.c: two prefix memory leaks
* isisd/isis_csm.c: one missing break
* isisd/isis_lsp.c: one possible NULL deref
* isisd/isis_pfpacket.c: one error-case fd leak
* isisd/isis_route.c: one isis_route_info memory leak
* isisd/isis_routemap.c: one... fnord
* isisd/isis_tlv.c: one infinite loop
Reported-by: Coverity SCAN
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c
index 082e9dc..f2a7923 100644
--- a/isisd/isis_lsp.c
+++ b/isisd/isis_lsp.c
@@ -1631,7 +1631,7 @@
static int
lsp_regenerate (struct isis_area *area, int level)
{
- dict_t *lspdb = area->lspdb[level - 1];
+ dict_t *lspdb;
struct isis_lsp *lsp, *frag;
struct listnode *node;
u_char lspid[ISIS_SYS_ID_LEN + 2];
@@ -1640,6 +1640,8 @@
if ((area == NULL) || (area->is_type & level) != level)
return ISIS_ERROR;
+ lspdb = area->lspdb[level - 1];
+
memset (lspid, 0, ISIS_SYS_ID_LEN + 2);
memcpy (lspid, isis->sysid, ISIS_SYS_ID_LEN);