Fix coverity issue
[vpp.git] / src / vnet / lisp-gpe / lisp_gpe_fwd_entry.c
index c898b9f..0b7b0fe 100644 (file)
@@ -424,6 +424,9 @@ vnet_lisp_gpe_add_fwd_counters (vnet_lisp_gpe_add_del_fwd_entry_args_t * a,
 
   lfe = find_fwd_entry (lgm, a, &fe_key);
 
+  if (!lfe)
+    return;
+
   if (LISP_GPE_FWD_ENTRY_TYPE_NORMAL != lfe->type)
     return;
 
@@ -478,6 +481,7 @@ add_ip_fwd_entry (lisp_gpe_main_t * lgm,
 
   hash_set_mem (lgm->lisp_gpe_fwd_entries, lfe->key,
                lfe - lgm->lisp_fwd_entry_pool);
+  a->fwd_entry_index = lfe - lgm->lisp_fwd_entry_pool;
 
   fproto = (IP4 == ip_prefix_version (&fid_addr_ippref (&lfe->key->rmt)) ?
            FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6);
@@ -791,6 +795,7 @@ add_l2_fwd_entry (lisp_gpe_main_t * lgm,
 
   hash_set_mem (lgm->lisp_gpe_fwd_entries, lfe->key,
                lfe - lgm->lisp_fwd_entry_pool);
+  a->fwd_entry_index = lfe - lgm->lisp_fwd_entry_pool;
 
   lfe->type = (a->is_negative ?
               LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE :
@@ -1064,6 +1069,7 @@ add_nsh_fwd_entry (lisp_gpe_main_t * lgm,
 
   hash_set_mem (lgm->lisp_gpe_fwd_entries, lfe->key,
                lfe - lgm->lisp_fwd_entry_pool);
+  a->fwd_entry_index = lfe - lgm->lisp_fwd_entry_pool;
 
   lfe->type = (a->is_negative ?
               LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE :