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
This commit is contained in:
parent
1eab806d9b
commit
d8f00e22e1
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue