From 7c0c580c4b0093437ee81e11934ef5b8d27a5bb4 Mon Sep 17 00:00:00 2001 From: Dario Lombardo Date: Sat, 4 Feb 2017 16:26:34 +0100 Subject: wiretap: add cleanup routine. The cleanup routine has been added to exit section of the applications. Those which required a exit restyle have been patched as well. Change-Id: I3a8787f0718ac7fef00dc58176869c7510fda7b1 Reviewed-on: https://code.wireshark.org/review/19949 Petri-Dish: Dario Lombardo Reviewed-by: Peter Wu Tested-by: Petri Dish Buildbot Reviewed-by: Dario Lombardo --- wsutil/buffer.c | 10 ++++++++++ wsutil/buffer.h | 2 ++ 2 files changed, 12 insertions(+) (limited to 'wsutil') diff --git a/wsutil/buffer.c b/wsutil/buffer.c index 7d9d44b1b4..5108ee8905 100644 --- a/wsutil/buffer.c +++ b/wsutil/buffer.c @@ -178,6 +178,16 @@ ws_buffer_append_buffer(Buffer* buffer, Buffer* src_buffer) } #endif +void +ws_buffer_cleanup(void) +{ + if (small_buffers) { + g_ptr_array_set_free_func(small_buffers, g_free); + g_ptr_array_free(small_buffers, TRUE); + small_buffers = NULL; + } +} + /* * Editor modelines - http://www.wireshark.org/tools/modelines.html * diff --git a/wsutil/buffer.h b/wsutil/buffer.h index d8047cd1fd..34caf2a332 100644 --- a/wsutil/buffer.h +++ b/wsutil/buffer.h @@ -48,6 +48,8 @@ WS_DLL_PUBLIC void ws_buffer_append(Buffer* buffer, guint8 *from, gsize bytes); WS_DLL_PUBLIC void ws_buffer_remove_start(Buffer* buffer, gsize bytes); +WS_DLL_PUBLIC +void ws_buffer_cleanup(void); #ifdef SOME_FUNCTIONS_ARE_DEFINES # define ws_buffer_clean(buffer) ws_buffer_remove_start((buffer), ws_buffer_length(buffer)) -- cgit v1.2.1