summaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/strategies/strategy_mw.c
diff options
context:
space:
mode:
authorAlberto Compagno <acompagn+fdio@cisco.com>2020-01-14 12:02:48 +0100
committerAlberto Compagno <acompagn+fdio@cisco.com>2020-01-15 09:13:11 +0100
commitf2de2bfea184034f675ab4a521e7deaae58c5ff8 (patch)
treecff17c97eba04055f659aa59d0940b6f31cce5f9 /hicn-plugin/src/strategies/strategy_mw.c
parentdef98b1a2af5292519b18893133e419e940a850b (diff)
[HICN-477] Fixed strategy get ctx that could lead to a segfault
Change-Id: Ic0d4f5a6919cb68255e788ac288d17492a6570a5 Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com>
Diffstat (limited to 'hicn-plugin/src/strategies/strategy_mw.c')
-rw-r--r--hicn-plugin/src/strategies/strategy_mw.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hicn-plugin/src/strategies/strategy_mw.c b/hicn-plugin/src/strategies/strategy_mw.c
index d5ff87303..40e062bd8 100644
--- a/hicn-plugin/src/strategies/strategy_mw.c
+++ b/hicn-plugin/src/strategies/strategy_mw.c
@@ -73,6 +73,9 @@ hicn_select_next_hop_mw (index_t dpo_idx, int *nh_idx, dpo_id_t ** outface)
hicn_strategy_mw_ctx_t *hicn_strategy_mw_ctx =
(hicn_strategy_mw_ctx_t *) hicn_strategy_mw_ctx_get (dpo_idx);
+ if(hicn_strategy_mw_ctx == NULL)
+ return HICN_ERROR_STRATEGY_NOT_FOUND;
+
u8 next_hop_index = 0;
for (int i = 0; i < hicn_strategy_mw_ctx->default_ctx.entry_count; i++)
{