diff options
author | Evan Huus <eapache@gmail.com> | 2013-08-13 22:41:34 +0000 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2013-08-13 22:41:34 +0000 |
commit | d8f00e22e117477ac7be2bd55b077aab63f8cb89 (patch) | |
tree | 8e56c2d68d2bec913bb8f9b0b59d3a9251b120ab | |
parent | 1eab806d9bb46fde55eb07a9fe92d568cb1f8112 (diff) | |
download | wireshark-d8f00e22e117477ac7be2bd55b077aab63f8cb89.tar.gz |
As suggested in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9033
Make epan_free a no-op if the pointer is NULL. This fixes 99% of the cases
causing problems for wmem_leave_file_scope() - remove that XXX comment and add
back the assertion.
Remove the cleanup_dissection call from epan_cleanup, it doesn't make sense
there. init_dissection is only called from epan_new, so cleanup_dissection
should only be called from epan_free.
Add one missing epan_free call to tshark revealed by the above changes.
svn path=/trunk/; revision=51342
-rw-r--r-- | epan/epan.c | 9 | ||||
-rw-r--r-- | epan/wmem/wmem_scopes.c | 12 | ||||
-rw-r--r-- | tshark.c | 1 |
3 files changed, 7 insertions, 15 deletions
diff --git a/epan/epan.c b/epan/epan.c index 6555932c72..7ce4fe399e 100644 --- a/epan/epan.c +++ b/epan/epan.c @@ -123,7 +123,6 @@ epan_init(void (*register_all_protocols_func)(register_cb cb, gpointer client_da void epan_cleanup(void) { - cleanup_dissection(); dfilter_cleanup(); proto_cleanup(); prefs_cleanup(); @@ -184,10 +183,12 @@ epan_get_frame_ts(const epan_t *session, guint32 frame_num) void epan_free(epan_t *session) { - /* XXX, it should take session as param */ - cleanup_dissection(); + if (session) { + /* XXX, it should take session as param */ + cleanup_dissection(); - g_slice_free(epan_t, session); + g_slice_free(epan_t, session); + } } void diff --git a/epan/wmem/wmem_scopes.c b/epan/wmem/wmem_scopes.c index 95f9a3b1b5..d677d2d2db 100644 --- a/epan/wmem/wmem_scopes.c +++ b/epan/wmem/wmem_scopes.c @@ -106,18 +106,8 @@ wmem_enter_file_scope(void) void wmem_leave_file_scope(void) { - /* XXX: cleanup_dissection (the current caller of this function) is - * itself sometimes called when no file exists to be cleaned up. It's not - * a huge problem really, but it means that we can't assert - * file_scope->in_scope here because it's not always true. - * - * At some point the code should be fixed so that cleanup_dissection is - * only ever called when it's really needed. - * - * g_assert(file_scope->in_scope); - */ - g_assert(file_scope); + g_assert(file_scope->in_scope); g_assert(!packet_scope->in_scope); wmem_free_all(file_scope); @@ -2084,6 +2084,7 @@ main(int argc, char *argv[]) draw_tap_listeners(TRUE); funnel_dump_all_text_windows(); + epan_free(cfile.epan); epan_cleanup(); output_fields_free(output_fields); |