diff options
author | Neale Ranns <neale@graphiant.com> | 2022-01-09 13:27:04 +0000 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2022-01-27 20:07:27 +0000 |
commit | 0d47f20940003088df0c06f684350cc8da9a7f7a (patch) | |
tree | c4db0523f0cd851e4beaae9ae6ecfa9f6bd1a471 /src/vppinfra/sparse_vec.h | |
parent | 4a6306aa6920120b99ade708e7346953424de456 (diff) |
vppinfra: sparse_vec_free free should free the sparse_vec_header not the embedded vec_header_t
Type: fix
Signed-off-by: Neale Ranns <neale@graphiant.com>
Change-Id: Ie9532543c4d4439beec8ce097eafa34588ad1266
Diffstat (limited to 'src/vppinfra/sparse_vec.h')
-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))) |