vcl: validate fs before cleanup
Type: fix
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I1d3677923ab28325380c4a9e8469da83077262a9
diff --git a/src/vcl/vcl_private.c b/src/vcl/vcl_private.c
index eb01d1c..ba54c91 100644
--- a/src/vcl/vcl_private.c
+++ b/src/vcl/vcl_private.c
@@ -459,8 +459,11 @@
fifo_segment_free_client_fifo (fs, s->tx_fifo);
if (s->ct_rx_fifo)
{
- fs = fifo_segment_get_segment (&vcm->segment_main,
- s->ct_rx_fifo->segment_index);
+ fs = fifo_segment_get_segment_if_valid (&vcm->segment_main,
+ s->ct_rx_fifo->segment_index);
+ if (!fs)
+ goto done;
+
fifo_segment_free_client_fifo (fs, s->ct_rx_fifo);
fifo_segment_free_client_fifo (fs, s->ct_tx_fifo);
}