forked from osmocom/wireshark
filter_list: add cleanup function and call it on exit.
Change-Id: I51d8074cc5a63d4fd3af8852df120d6b4163217f Reviewed-on: https://code.wireshark.org/review/19942 Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
parent
59fc668845
commit
9ced31a2d7
|
@ -90,6 +90,23 @@ add_filter_entry(GList *fl, const char *filt_name, const char *filt_expr)
|
|||
return g_list_append(fl, filt);
|
||||
}
|
||||
|
||||
static void
|
||||
free_filter_entry(gpointer data)
|
||||
{
|
||||
filter_def *filt = (filter_def*)data;
|
||||
g_free(filt->name);
|
||||
g_free(filt->strval);
|
||||
g_free(filt);
|
||||
}
|
||||
|
||||
void free_filter_lists(void)
|
||||
{
|
||||
g_list_free_full(capture_filters, free_filter_entry);
|
||||
g_list_free_full(display_filters, free_filter_entry);
|
||||
g_list_free_full(capture_edited_filters, free_filter_entry);
|
||||
g_list_free_full(display_edited_filters, free_filter_entry);
|
||||
}
|
||||
|
||||
static GList *
|
||||
remove_filter_entry(GList *fl, GList *fl_entry)
|
||||
{
|
||||
|
|
|
@ -89,6 +89,11 @@ void save_filter_list(filter_list_type_t list_type, char **pref_path_return,
|
|||
*/
|
||||
void copy_filter_list(filter_list_type_t dest_type, filter_list_type_t src_type);
|
||||
|
||||
/*
|
||||
* Free all filter lists
|
||||
*/
|
||||
void free_filter_lists(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
|
1
sharkd.c
1
sharkd.c
|
@ -298,6 +298,7 @@ main(int argc, char *argv[])
|
|||
ret = sharkd_loop();
|
||||
clean_exit:
|
||||
col_cleanup(&cfile.cinfo);
|
||||
free_filter_lists();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
1
tshark.c
1
tshark.c
|
@ -2201,6 +2201,7 @@ clean_exit:
|
|||
capture_opts_cleanup(&global_capture_opts);
|
||||
#endif
|
||||
col_cleanup(&cfile.cinfo);
|
||||
free_filter_lists();
|
||||
return exit_status;
|
||||
}
|
||||
|
||||
|
|
|
@ -2815,6 +2815,7 @@ clean_exit:
|
|||
capture_opts_cleanup(&global_capture_opts);
|
||||
#endif
|
||||
col_cleanup(&cfile.cinfo);
|
||||
free_filter_lists();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -716,6 +716,11 @@ WiresharkApplication::WiresharkApplication(int &argc, char **argv) :
|
|||
connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(cleanup()));
|
||||
}
|
||||
|
||||
WiresharkApplication::~WiresharkApplication()
|
||||
{
|
||||
free_filter_lists();
|
||||
}
|
||||
|
||||
void WiresharkApplication::registerUpdate(register_action_e action, const char *message)
|
||||
{
|
||||
emit splashUpdate(action, message);
|
||||
|
|
|
@ -60,6 +60,7 @@ class WiresharkApplication : public QApplication
|
|||
Q_OBJECT
|
||||
public:
|
||||
explicit WiresharkApplication(int &argc, char **argv);
|
||||
~WiresharkApplication();
|
||||
|
||||
enum AppSignal {
|
||||
CaptureFilterListChanged,
|
||||
|
|
Loading…
Reference in New Issue