forked from osmocom/wireshark
stats_tree: add cleanup function.
Change-Id: Iefd264bdd79af172c245c3a30119999cca9d56c0 Reviewed-on: https://code.wireshark.org/review/19976 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Dario Lombardo <lomato@gmail.com>
This commit is contained in:
parent
a2ce68451e
commit
c31b8da721
|
@ -64,6 +64,7 @@
|
|||
#include "conversation_table.h"
|
||||
#include "reassemble.h"
|
||||
#include "srt_table.h"
|
||||
#include "stats_tree.h"
|
||||
|
||||
#ifdef HAVE_LUA
|
||||
#include <lua.h>
|
||||
|
@ -227,6 +228,7 @@ epan_cleanup(void)
|
|||
follow_cleanup();
|
||||
disabled_protos_cleanup();
|
||||
cleanup_srt_table();
|
||||
stats_tree_cleanup();
|
||||
#ifdef HAVE_LUA
|
||||
wslua_cleanup();
|
||||
#endif
|
||||
|
|
|
@ -245,6 +245,16 @@ stats_tree_reinit(void *p)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
stats_tree_cfg_free(gpointer p)
|
||||
{
|
||||
stats_tree_cfg* cfg = (stats_tree_cfg*)p;
|
||||
g_free(cfg->tapname);
|
||||
g_free(cfg->abbr);
|
||||
g_free(cfg->name);
|
||||
g_free(cfg);
|
||||
}
|
||||
|
||||
/* register a new stats_tree */
|
||||
extern void
|
||||
stats_tree_register_with_group(const char *tapname, const char *abbr, const char *name,
|
||||
|
@ -269,7 +279,7 @@ stats_tree_register_with_group(const char *tapname, const char *abbr, const char
|
|||
cfg->flags = flags&~ST_FLG_MASK;
|
||||
cfg->st_flags = flags&ST_FLG_MASK;
|
||||
|
||||
if (!registry) registry = g_hash_table_new(g_str_hash,g_str_equal);
|
||||
if (!registry) registry = g_hash_table_new_full(g_str_hash,g_str_equal,NULL,stats_tree_cfg_free);
|
||||
|
||||
g_hash_table_insert(registry,cfg->abbr,cfg);
|
||||
}
|
||||
|
@ -1321,6 +1331,11 @@ WS_DLL_PUBLIC void stats_tree_format_node_as_str(const stat_node *node,
|
|||
}
|
||||
}
|
||||
|
||||
void stats_tree_cleanup(void)
|
||||
{
|
||||
g_hash_table_destroy(registry);
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
||||
*
|
||||
|
|
|
@ -182,6 +182,9 @@ WS_DLL_PUBLIC int stats_tree_tick_pivot(stats_tree *st,
|
|||
int pivot_id,
|
||||
const gchar *pivot_value);
|
||||
|
||||
extern void stats_tree_cleanup(void);
|
||||
|
||||
|
||||
/*
|
||||
* manipulates the value of the node whose name is given
|
||||
* if the node does not exist yet it's created (with counter=1)
|
||||
|
|
Loading…
Reference in New Issue