diff options
-rw-r--r-- | src/vppinfra/sparse_vec.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/vppinfra/sparse_vec.h b/src/vppinfra/sparse_vec.h index fc8b3cf1e8e..2245be88262 100644 --- a/src/vppinfra/sparse_vec.h +++ b/src/vppinfra/sparse_vec.h @@ -223,7 +223,16 @@ sparse_vec_index2 (void *v, *i1_return = is_member1 + d1; } -#define sparse_vec_free(v) vec_free(v) +#define sparse_vec_free(V) \ + do \ + { \ + if (V) \ + { \ + clib_mem_free (sparse_vec_header (V)); \ + V = 0; \ + } \ + } \ + while (0) #define sparse_vec_elt_at_index(v,i) \ vec_elt_at_index ((v), sparse_vec_index ((v), (i))) |