diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2018-05-30 09:00:16 +0200 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2018-06-03 20:18:05 +0000 |
commit | 5767118ec9098bf8eeae9c0f7860ed3a48477c79 (patch) | |
tree | 192a3b94d68b4c36d5b509445bb69a054bacef6c /epan/epan.c | |
parent | 5c51008ef0898adae9ce12283e34b29a9c406c9f (diff) |
Free dynamic header fields on exit
Put routine to free all dynamically registered header fields in the
UAT reset callback to avoid ASAN report for memory leaks on exit.
Handle duplicated entries without leaking memory.
Call proto_free_deregistered_fields() in proto_cleanup() and move
this after prefs_cleanup() to free the memory used in UATs.
Change-Id: I96545177b5b23b9c20ad8e7751a0d5621c9ca10f
Reviewed-on: https://code.wireshark.org/review/27907
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'epan/epan.c')
-rw-r--r-- | epan/epan.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/epan/epan.c b/epan/epan.c index 3dfcde7c42..fe1f660c94 100644 --- a/epan/epan.c +++ b/epan/epan.c @@ -307,13 +307,22 @@ epan_cleanup(void) epan_register_all_handoffs = NULL; dfilter_cleanup(); - proto_cleanup(); - prefs_cleanup(); decode_clear_all(); + + /* + * Note: packet_cleanup() will call registered shutdown routines which + * may be used to deregister dynamically registered protocol fields, + * and prefs_cleanup() will call uat_clear() which also may be used to + * deregister dynamically registered protocol fields. This must be done + * before proto_cleanup() to avoid inconsistency and memory leaks. + */ + packet_cleanup(); + prefs_cleanup(); + proto_cleanup(); + conversation_filters_cleanup(); reassembly_table_cleanup(); tap_cleanup(); - packet_cleanup(); expert_cleanup(); capture_dissector_cleanup(); export_pdu_cleanup(); |