diff options
author | Anders Broman <anders.broman@ericsson.com> | 2012-04-26 08:41:47 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2012-04-26 08:41:47 +0000 |
commit | 748687252337c4e8ab0e5488f609deb56d21950f (patch) | |
tree | aad93dfdfe5ab40db6f172e11b143f122ca301d1 /epan/epan.c | |
parent | 3980d56370578f6108e9475e30d9f9ed0052c44d (diff) | |
download | wireshark-748687252337c4e8ab0e5488f609deb56d21950f.tar.gz |
Refcount edt.s as we may have atleast two "active" edt:s in certain
circumstances see bug https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5284
patch by Evan Huus
svn path=/trunk/; revision=42254
Diffstat (limited to 'epan/epan.c')
-rw-r--r-- | epan/epan.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/epan/epan.c b/epan/epan.c index 3778f066a7..538026007f 100644 --- a/epan/epan.c +++ b/epan/epan.c @@ -71,6 +71,13 @@ #include "geoip_db.h" #endif +/* + * Refcount the edt:s and don't free ep memory until refcount = 0 + * See https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5284 + * + */ +static guint edt_refs = 0; + const gchar* epan_get_version(void) { return VERSION; @@ -174,6 +181,8 @@ epan_dissect_init(epan_dissect_t *edt, const gboolean create_proto_tree, const g edt->pi.dependent_frames = NULL; + edt_refs++; + return edt; } @@ -198,9 +207,6 @@ void epan_dissect_run(epan_dissect_t *edt, void* pseudo_header, const guint8* data, frame_data *fd, column_info *cinfo) { - /* free all memory allocated during previous packet */ - ep_free_all(); - dissect_packet(edt, pseudo_header, data, fd, cinfo); } @@ -220,6 +226,11 @@ epan_dissect_cleanup(epan_dissect_t* edt) if (edt->tree) { proto_tree_free(edt->tree); } + + edt_refs--; + + if (edt_refs == 0) + ep_free_all(); } void |