summaryrefslogtreecommitdiff
path: root/zebra/zapi_msg.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zapi_msg.c')
-rw-r--r--zebra/zapi_msg.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c
index 27fb5d7c22..66208bfd80 100644
--- a/zebra/zapi_msg.c
+++ b/zebra/zapi_msg.c
@@ -1937,6 +1937,11 @@ static void zread_nhg_add(ZAPI_HANDLER_ARGS)
flog_warn(EC_ZEBRA_NEXTHOP_CREATION_FAILED,
"%s: Nexthop Group Creation failed", __func__);
+
+ /* Free any local allocations */
+ nexthop_group_delete(&nhg);
+ zebra_nhg_backup_free(&bnhg);
+
return;
}
@@ -2110,6 +2115,15 @@ static void zread_route_add(ZAPI_HANDLER_ARGS)
ret = rib_add_multipath_nhe(afi, api.safi, &api.prefix, src_p,
re, &nhe);
+ /*
+ * rib_add_multipath_nhe only fails in a couple spots
+ * and in those spots we have not freed memory
+ */
+ if (ret == -1) {
+ client->error_cnt++;
+ XFREE(MTYPE_RE, re);
+ }
+
/* At this point, these allocations are not needed: 're' has been
* retained or freed, and if 're' still exists, it is using
* a reference to a shared group object.
@@ -2121,15 +2135,15 @@ static void zread_route_add(ZAPI_HANDLER_ARGS)
/* Stats */
switch (api.prefix.family) {
case AF_INET:
- if (ret > 0)
+ if (ret == 0)
client->v4_route_add_cnt++;
- else if (ret < 0)
+ else if (ret == 1)
client->v4_route_upd8_cnt++;
break;
case AF_INET6:
- if (ret > 0)
+ if (ret == 0)
client->v6_route_add_cnt++;
- else if (ret < 0)
+ else if (ret == 1)
client->v6_route_upd8_cnt++;
break;
}