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
This commit is contained in:
Anders Broman 2012-04-26 08:41:47 +00:00
parent 3980d56370
commit 7486872523
1 changed files with 14 additions and 3 deletions

View File

@ -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