Check get packet template allocation failure (VPP-1321)
[vpp.git] / src / plugins / cdp / cdp_periodic.c
index c67af00..a4c4bb9 100644 (file)
@@ -195,6 +195,9 @@ send_hdlc_hello (cdp_main_t * cm, cdp_neighbor_t * n, int count)
       h0 = vlib_packet_template_get_packet
        (vm, &cm->packet_templates[n->packet_template_index], &bi0);
 
+      if (!h0)
+       break;
+
       hw = vnet_get_sup_hw_interface (vnm, n->sw_if_index);
 
       t0 = (u8 *) & h0->cdp.data;
@@ -251,6 +254,9 @@ send_srp_hello (cdp_main_t * cm, cdp_neighbor_t * n, int count)
       h0 = vlib_packet_template_get_packet
        (vm, &cm->packet_templates[n->packet_template_index], &bi0);
 
+      if (!h0)
+       break;
+
       hw = vnet_get_sup_hw_interface (vnm, n->sw_if_index);
 
       t0 = (u8 *) & h0->cdp.data;