buffer: bug fix vlib_buffer_free_inline
buffer_pool_index, in case of buffer_pool_index change,
should free buffers in queue before setting buffer_pool_index again
@@ -767,18 +767,19 @@ vlib_buffer_free_inline (vlib_main_t * vm, u32 * buffers, u32 n_buffers,
if (PREDICT_FALSE (buffer_pool_index != b[0]->buffer_pool_index))
{
- buffer_pool_index = b[0]->buffer_pool_index;
-#if defined(CLIB_HAVE_VEC128) && !__aarch64__
- bpi_vec.buffer_pool_index = buffer_pool_index;
-#endif
- bp = vlib_get_buffer_pool (vm, buffer_pool_index);
- vlib_buffer_copy_template (&bt, &bp->buffer_template);
if (n_queue)
{
vlib_buffer_pool_put (vm, buffer_pool_index, queue, n_queue);
n_queue = 0;
}
+
+ buffer_pool_index = b[0]->buffer_pool_index;
+#if defined(CLIB_HAVE_VEC128) && !__aarch64__
+ bpi_vec.buffer_pool_index = buffer_pool_index;
+#endif
+ bp = vlib_get_buffer_pool (vm, buffer_pool_index);
+ vlib_buffer_copy_template (&bt, &bp->buffer_template);
}
vlib_buffer_validate (vm, b[0]);
