From 946f918a27c194e5a305db607eefb6ec83b5f5f1 Mon Sep 17 00:00:00 2001 From: Benoît Ganne Date: Thu, 26 Jan 2023 19:23:19 +0100 Subject: vppinfra: keep AddressSanitizer happy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The vector size must be increased before setting the element so that AddressSanitizer can keep track of the accessible memory. Type: fix Change-Id: I7b13ce98ff29d98e643f399ec1ecb4681d3cec92 Signed-off-by: Benoît Ganne --- src/vppinfra/pool.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/vppinfra') diff --git a/src/vppinfra/pool.h b/src/vppinfra/pool.h index ef816096ff0..ea22af4a68b 100644 --- a/src/vppinfra/pool.h +++ b/src/vppinfra/pool.h @@ -295,8 +295,9 @@ _pool_put_index (void *p, uword index, uword elt_sz) /* Preallocated pool? */ if (ph->max_elts) { - ph->free_indices[_vec_len (ph->free_indices)] = index; - vec_inc_len (ph->free_indices, 1); + u32 len = _vec_len (ph->free_indices); + vec_set_len (ph->free_indices, len + 1); + ph->free_indices[len] = index; } else vec_add1 (ph->free_indices, index); -- cgit 1.2.3-korg