diff options
author | João Valverde <joao.valverde@tecnico.ulisboa.pt> | 2016-01-02 07:38:43 +0000 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2020-07-22 22:46:28 +0000 |
commit | 7be4a8fb0057839062b5dd061fd871f3f0943acc (patch) | |
tree | 89eb02e9d06a178b2aa3ec8960296aa43d3ff81a | |
parent | c8bda0764112a454709859b388e6a4d2129b8ef1 (diff) | |
download | wireshark-7be4a8fb0057839062b5dd061fd871f3f0943acc.tar.gz wireshark-7be4a8fb0057839062b5dd061fd871f3f0943acc.tar.bz2 wireshark-7be4a8fb0057839062b5dd061fd871f3f0943acc.zip |
Add wmem_destroy_array()
Change-Id: I00a0052a9c207692eddab7ac2d0f146201648f6c
Reviewed-on: https://code.wireshark.org/review/13003
Reviewed-by: João Valverde <j@v6e.pt>
-rw-r--r-- | debian/libwireshark0.symbols | 1 | ||||
-rw-r--r-- | epan/wmem/wmem_array.c | 7 | ||||
-rw-r--r-- | epan/wmem/wmem_array.h | 4 | ||||
-rw-r--r-- | epan/wmem/wmem_test.c | 4 |
4 files changed, 16 insertions, 0 deletions
diff --git a/debian/libwireshark0.symbols b/debian/libwireshark0.symbols index c00bf5f024..849e2ece53 100644 --- a/debian/libwireshark0.symbols +++ b/debian/libwireshark0.symbols @@ -1989,6 +1989,7 @@ libwireshark.so.0 libwireshark0 #MINVER# wmem_ascii_strdown@Base 1.12.0~rc1 wmem_cleanup@Base 1.12.0~rc1 wmem_destroy_allocator@Base 1.9.1 + wmem_destroy_array@Base 3.3.0 wmem_destroy_list@Base 1.12.0~rc1 wmem_double_hash@Base 1.12.0~rc1 wmem_epan_scope@Base 1.9.1 diff --git a/epan/wmem/wmem_array.c b/epan/wmem/wmem_array.c index bf106764d2..27a836f33e 100644 --- a/epan/wmem/wmem_array.c +++ b/epan/wmem/wmem_array.c @@ -158,6 +158,13 @@ wmem_array_get_count(wmem_array_t *array) return array->elem_count; } +void +wmem_destroy_array(wmem_array_t *array) +{ + wmem_free(array->allocator, array->buf); + wmem_free(array->allocator, array); +} + /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * diff --git a/epan/wmem/wmem_array.h b/epan/wmem/wmem_array.h index 0fdd27fce9..c1fd708410 100644 --- a/epan/wmem/wmem_array.h +++ b/epan/wmem/wmem_array.h @@ -80,6 +80,10 @@ WS_DLL_PUBLIC guint wmem_array_get_count(wmem_array_t *array); +WS_DLL_PUBLIC +void +wmem_destroy_array(wmem_array_t *array); + /** @} * @} */ diff --git a/epan/wmem/wmem_test.c b/epan/wmem/wmem_test.c index 8082fe8324..c25e095829 100644 --- a/epan/wmem/wmem_test.c +++ b/epan/wmem/wmem_test.c @@ -671,6 +671,8 @@ wmem_test_array(void) g_assert(val == i); } + wmem_destroy_array(array); + array = wmem_array_sized_new(allocator, sizeof(guint32), 73); wmem_array_set_null_terminator(array); for (i=0; i<75; i++) @@ -725,6 +727,8 @@ wmem_test_array(void) g_assert(raw[wmem_array_get_count(array)] == 0); g_assert(raw[wmem_array_get_count(array) - 1] == lastint); + wmem_destroy_array(array); + wmem_destroy_allocator(allocator); } |