From a383e692c8774c2451a55d8b3f8ef9db5d037329 Mon Sep 17 00:00:00 2001 From: Pascal Quantin Date: Sun, 19 Jun 2016 11:01:56 +0200 Subject: Revert "tap: change glib functions to wmem." This reverts commit 2e9f3c5d366eaa7139fc877b5301392166b3f985. It breaks the registration of codec, dissector and libwiretap plugins. Change-Id: I4ef91dd192f765adf87ea9fe9f3693e25dbd24de Reviewed-on: https://code.wireshark.org/review/16012 Petri-Dish: Pascal Quantin Reviewed-by: Pascal Quantin --- dftest.c | 9 +++ epan/dissectors/packet-smb-sidsnooping.c | 10 +-- epan/dissectors/packet-smb.c | 4 +- epan/dissectors/packet-smb2.c | 4 +- epan/epan.c | 14 ---- epan/tap.c | 48 +++++++------ epan/tap.h | 8 +-- epan/wslua/wslua_field.c | 6 +- epan/wslua/wslua_listener.c | 6 +- plugins/mate/packet-mate.c | 6 +- rawshark.c | 6 +- tfshark.c | 10 +++ tshark.c | 6 ++ ui/cli/tap-camelsrt.c | 6 +- ui/cli/tap-comparestat.c | 6 +- ui/cli/tap-diameter-avp.c | 6 +- ui/cli/tap-endpoints.c | 6 +- ui/cli/tap-expert.c | 6 +- ui/cli/tap-follow.c | 4 +- ui/cli/tap-gsm_astat.c | 4 +- ui/cli/tap-hosts.c | 6 +- ui/cli/tap-httpstat.c | 6 +- ui/cli/tap-icmpstat.c | 6 +- ui/cli/tap-icmpv6stat.c | 6 +- ui/cli/tap-iostat.c | 6 +- ui/cli/tap-iousers.c | 6 +- ui/cli/tap-macltestat.c | 4 +- ui/cli/tap-protocolinfo.c | 6 +- ui/cli/tap-protohierstat.c | 6 +- ui/cli/tap-rlcltestat.c | 4 +- ui/cli/tap-rpcprogs.c | 6 +- ui/cli/tap-rtd.c | 6 +- ui/cli/tap-rtp.c | 4 +- ui/cli/tap-rtspstat.c | 6 +- ui/cli/tap-sctpchunkstat.c | 6 +- ui/cli/tap-simple_stattable.c | 6 +- ui/cli/tap-sipstat.c | 6 +- ui/cli/tap-smbsids.c | 6 +- ui/cli/tap-srt.c | 6 +- ui/cli/tap-stats_tree.c | 5 +- ui/cli/tap-sv.c | 6 +- ui/cli/tap-wspstat.c | 6 +- ui/gtk/compare_stat.c | 6 +- ui/gtk/conversations_table.c | 12 ++-- ui/gtk/dcerpc_stat.c | 6 +- ui/gtk/expert_comp_dlg.c | 20 +++--- ui/gtk/export_object_dlg.c | 6 +- ui/gtk/follow_stream.c | 5 +- ui/gtk/gsm_map_summary.c | 6 +- ui/gtk/hostlist_table.c | 12 ++-- ui/gtk/iax2_analysis.c | 6 +- ui/gtk/io_stat.c | 6 +- ui/gtk/lbm_stream_dlg.c | 6 +- ui/gtk/lbm_uimflow_dlg.c | 6 +- ui/gtk/mac_lte_stat_dlg.c | 6 +- ui/gtk/main.c | 5 ++ ui/gtk/mtp3_summary.c | 6 +- ui/gtk/response_time_delay_table.c | 6 +- ui/gtk/rlc_lte_stat_dlg.c | 6 +- ui/gtk/rpc_stat.c | 6 +- ui/gtk/rtp_analysis.c | 6 +- ui/gtk/sctp_chunk_stat.c | 6 +- ui/gtk/service_response_time_table.c | 6 +- ui/gtk/simple_stattable.c | 6 +- ui/gtk/stats_tree_stat.c | 6 +- ui/gtk/wlan_stat_dlg.c | 12 ++-- ui/mcast_stream.c | 8 +-- ui/qt/bluetooth_device_dialog.cpp | 6 +- ui/qt/bluetooth_hci_summary_dialog.cpp | 6 +- ui/qt/expert_info_dialog.cpp | 6 +- ui/qt/gsm_map_summary_dialog.cpp | 6 +- ui/qt/io_graph_dialog.cpp | 13 ++-- ui/qt/lbm_lbtrm_transport_dialog.cpp | 6 +- ui/qt/lbm_lbtru_transport_dialog.cpp | 6 +- ui/qt/lbm_stream_dialog.cpp | 6 +- ui/qt/mtp3_summary_dialog.cpp | 6 +- ui/qt/wireshark_dialog.cpp | 6 +- ui/rtp_stream.c | 6 +- ui/tap-rlc-graph.c | 12 ++-- ui/tap-sctp-analysis.c | 6 +- ui/tap-tcp-stream.c | 12 ++-- ui/tap_export_pdu.c | 8 ++- ui/voip_calls.c | 120 +++++++++++++++---------------- wireshark-qt.cpp | 20 +++--- 84 files changed, 377 insertions(+), 356 deletions(-) diff --git a/dftest.c b/dftest.c index 1bd146ee7e..9b4276ecac 100644 --- a/dftest.c +++ b/dftest.c @@ -82,6 +82,15 @@ main(int argc, char **argv) timestamp_set_type(TS_RELATIVE); timestamp_set_seconds_type(TS_SECONDS_DEFAULT); +#ifdef HAVE_PLUGINS + /* Register all the plugin types we have. */ + epan_register_plugin_types(); /* Types known to libwireshark */ + + /* Scan for plugins. This does *not* call their registration routines; + that's done later. */ + scan_plugins(); +#endif + /* Register all dissectors; we must do this before checking for the "-g" flag, as the "-g" flag dumps a list of fields registered by the dissectors, and we must do it before we read the preferences, diff --git a/epan/dissectors/packet-smb-sidsnooping.c b/epan/dissectors/packet-smb-sidsnooping.c index 15adff8033..3a2ff1628c 100644 --- a/epan/dissectors/packet-smb-sidsnooping.c +++ b/epan/dissectors/packet-smb-sidsnooping.c @@ -263,7 +263,7 @@ ctx_handle_hash(gconstpointer k) static void sid_snooping_init(void) { - gchar *error_string; + GString *error_string; if(lsa_policy_information_tap_installed){ remove_tap_listener(&lsa_policy_information_tap_installed); @@ -310,8 +310,8 @@ sid_name_snooping=FALSE; /* error, we failed to attach to the tap. clean up */ report_failure( "Couldn't register proto_reg_handoff_smb_sidsnooping()/lsa_policy_information tap: %s\n", - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); return; } lsa_policy_information_tap_installed=TRUE; @@ -324,8 +324,8 @@ sid_name_snooping=FALSE; /* error, we failed to attach to the tap. clean up */ report_failure( "Couldn't register proto_reg_handoff_smb_sidsnooping()/samr_query_dispinfo tap: %s\n", - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); return; } samr_query_dispinfo_tap_installed=TRUE; diff --git a/epan/dissectors/packet-smb.c b/epan/dissectors/packet-smb.c index a73662833f..9ce5fb651e 100644 --- a/epan/dissectors/packet-smb.c +++ b/epan/dissectors/packet-smb.c @@ -6887,7 +6887,7 @@ dissect_session_setup_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree const ntlmssp_header_t *ntlmssph; if (!ntlmssp_tap_id) { - gchar *error_string; + GString *error_string; /* We don't specify any callbacks at all. * Instead we manually fetch the tapped data after the * security blob has been fully dissected and before @@ -6898,7 +6898,7 @@ dissect_session_setup_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree if (!error_string) { ntlmssp_tap_id = find_tap_id("ntlmssp"); } else { - wmem_free(NULL, error_string); + g_string_free(error_string, TRUE); } } diff --git a/epan/dissectors/packet-smb2.c b/epan/dissectors/packet-smb2.c index a8f1ebe810..7e82d2cbdd 100644 --- a/epan/dissectors/packet-smb2.c +++ b/epan/dissectors/packet-smb2.c @@ -2772,7 +2772,7 @@ dissect_smb2_session_setup_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree int idx; if (!ntlmssp_tap_id) { - gchar *error_string; + GString *error_string; /* We don't specify any callbacks at all. * Instead we manually fetch the tapped data after the * security blob has been fully dissected and before @@ -2783,7 +2783,7 @@ dissect_smb2_session_setup_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree if (!error_string) { ntlmssp_tap_id = find_tap_id("ntlmssp"); } else { - wmem_free(NULL, error_string); + g_string_free(error_string, TRUE); } } diff --git a/epan/epan.c b/epan/epan.c index 82c5168297..0927172570 100644 --- a/epan/epan.c +++ b/epan/epan.c @@ -24,7 +24,6 @@ #include #include -#include #ifdef HAVE_LIBGNUTLS #include @@ -119,12 +118,6 @@ epan_init(void (*register_all_protocols_func)(register_cb cb, gpointer client_da #ifdef HAVE_LIBGNUTLS gnutls_global_init(); #endif - -#ifdef HAVE_PLUGINS - /* Register all the plugin types we have. */ - epan_register_plugin_types(); /* Types known to libwireshark */ -#endif - TRY { tap_init(); prefs_init(); @@ -162,13 +155,6 @@ epan_init(void (*register_all_protocols_func)(register_cb cb, gpointer client_da status = FALSE; } ENDTRY; - -#ifdef HAVE_PLUGINS - /* Scan for plugins. This does *not* call their registration routines; - that's done later. */ - scan_plugins(); -#endif - return status; } diff --git a/epan/tap.c b/epan/tap.c index 129223fc0e..1348e375dd 100644 --- a/epan/tap.c +++ b/epan/tap.c @@ -39,7 +39,6 @@ #include #include #include -#include static gboolean tapping_is_active=FALSE; @@ -119,7 +118,7 @@ typedef struct { void (*register_tap_listener_fn)(void); /* routine to call to register tap listener */ } tap_plugin; -static wmem_list_t *tap_plugins = NULL; +static GSList *tap_plugins = NULL; /* * Callback for each plugin found. @@ -149,9 +148,9 @@ DIAG_ON(pedantic) /* * Add this one to the list of tap plugins. */ - plugin = wmem_new(NULL, tap_plugin); + plugin = (tap_plugin *)g_malloc(sizeof (tap_plugin)); plugin->register_tap_listener_fn = register_tap_listener_fn; - wmem_list_append(tap_plugins, plugin); + tap_plugins = g_slist_append(tap_plugins, plugin); return TRUE; } @@ -175,7 +174,7 @@ register_tap_plugin_listener(gpointer data, gpointer user_data _U_) void register_all_plugin_tap_listeners(void) { - wmem_list_foreach(tap_plugins, register_tap_plugin_listener, NULL); + g_slist_foreach(tap_plugins, register_tap_plugin_listener, NULL); } #endif /* HAVE_PLUGINS */ @@ -189,7 +188,6 @@ void tap_init(void) { tap_packet_index=0; - tap_plugins = wmem_list_new(NULL); } /* ********************************************************************** @@ -224,9 +222,9 @@ register_tap(const char *name) return tap_id; } - td=wmem_new(NULL, tap_dissector_t); + td=(tap_dissector_t *)g_malloc(sizeof(tap_dissector_t)); td->next=NULL; - td->name = wmem_strdup(NULL, name); + td->name = g_strdup(name); if(!tap_dissector_list){ tap_dissector_list=td; @@ -508,8 +506,10 @@ free_tap_listener(volatile tap_listener_t *tl) if(tl->code){ dfilter_free(tl->code); } - wmem_free(NULL, tl->fstring); - wmem_free(NULL, (void*)tl); + g_free(tl->fstring); +DIAG_OFF(cast-qual) + g_free((gpointer)tl); +DIAG_ON(cast-qual) } /* this function attaches the tap_listener to the named tap. @@ -518,28 +518,30 @@ free_tap_listener(volatile tap_listener_t *tl) * non-NULL: error, return value points to GString containing error * message. */ -gchar * +GString * register_tap_listener(const char *tapname, void *tapdata, const char *fstring, guint flags, tap_reset_cb reset, tap_packet_cb packet, tap_draw_cb draw) { volatile tap_listener_t *tl; int tap_id; dfilter_t *code=NULL; - gchar *error_string = NULL; + GString *error_string; gchar *err_msg; tap_id=find_tap_id(tapname); if(!tap_id){ - error_string = wmem_strdup_printf(NULL, "Tap %s not found", tapname); + error_string = g_string_new(""); + g_string_printf(error_string, "Tap %s not found", tapname); return error_string; } - tl=wmem_new0(NULL, volatile tap_listener_t); + tl=(volatile tap_listener_t *)g_malloc0(sizeof(tap_listener_t)); tl->needs_redraw=TRUE; tl->flags=flags; if(fstring){ if(!dfilter_compile(fstring, &code, &err_msg)){ - error_string = wmem_strdup_printf(NULL, + error_string = g_string_new(""); + g_string_printf(error_string, "Filter \"%s\" is invalid - %s", fstring, err_msg); g_free(err_msg); @@ -547,7 +549,7 @@ register_tap_listener(const char *tapname, void *tapdata, const char *fstring, return error_string; } } - tl->fstring=wmem_strdup(NULL, fstring); + tl->fstring=g_strdup(fstring); tl->code=code; tl->tap_id=tap_id; @@ -564,12 +566,12 @@ register_tap_listener(const char *tapname, void *tapdata, const char *fstring, /* this function sets a new dfilter to a tap listener */ -gchar * +GString * set_tap_dfilter(void *tapdata, const char *fstring) { volatile tap_listener_t *tl=NULL,*tl2; dfilter_t *code=NULL; - gchar *error_string; + GString *error_string; gchar *err_msg; if(!tap_listener_queue){ @@ -594,19 +596,19 @@ set_tap_dfilter(void *tapdata, const char *fstring) tl->code=NULL; } tl->needs_redraw=TRUE; - wmem_free(NULL, tl->fstring); + g_free(tl->fstring); if(fstring){ if(!dfilter_compile(fstring, &code, &err_msg)){ tl->fstring=NULL; - error_string = wmem_strdup_printf( - NULL, + error_string = g_string_new(""); + g_string_printf(error_string, "Filter \"%s\" is invalid - %s", fstring, err_msg); - wmem_free(NULL, err_msg); + g_free(err_msg); return error_string; } } - tl->fstring=wmem_strdup(NULL, fstring); + tl->fstring=g_strdup(fstring); tl->code=code; } diff --git a/epan/tap.h b/epan/tap.h index c17bafcd5e..c3b427f008 100644 --- a/epan/tap.h +++ b/epan/tap.h @@ -140,8 +140,8 @@ WS_DLL_PUBLIC void draw_tap_listeners(gboolean draw_all); /** this function attaches the tap_listener to the named tap. * function returns : * NULL: ok. - * non-NULL: error, return value points to gchar* containing error - * message. This value must be freed with wmem_free(). + * non-NULL: error, return value points to GString containing error + * message. * @param tapname The name of the tap we want to listen to. * @param tapdata is the instance identifier. The tap system uses the value of this * pointer to distinguish between different instances of a tap. @@ -211,12 +211,12 @@ WS_DLL_PUBLIC void draw_tap_listeners(gboolean draw_all); * or the file has been [re]read completely. */ -WS_DLL_PUBLIC gchar *register_tap_listener(const char *tapname, void *tapdata, +WS_DLL_PUBLIC GString *register_tap_listener(const char *tapname, void *tapdata, const char *fstring, guint flags, tap_reset_cb tap_reset, tap_packet_cb tap_packet, tap_draw_cb tap_draw); /** This function sets a new dfilter to a tap listener */ -WS_DLL_PUBLIC gchar *set_tap_dfilter(void *tapdata, const char *fstring); +WS_DLL_PUBLIC GString *set_tap_dfilter(void *tapdata, const char *fstring); /** This function recompiles dfilter for all registered tap listeners */ WS_DLL_PUBLIC void tap_listeners_dfilter_recompile(void); diff --git a/epan/wslua/wslua_field.c b/epan/wslua/wslua_field.c index 5707300be9..d64513c5a2 100644 --- a/epan/wslua/wslua_field.c +++ b/epan/wslua/wslua_field.c @@ -591,15 +591,15 @@ void lua_prime_all_fields(proto_tree* tree _U_) { if (fake_tap && fake_tap_filter->len > strlen("frame")) { /* a boring tap :-) */ - gchar* error = register_tap_listener("frame", + GString* error = register_tap_listener("frame", &fake_tap, fake_tap_filter->str, 0, /* XXX - do we need the protocol tree or columns? */ NULL, NULL, NULL); if (error) { - report_failure("while registering lua_fake_tap:\n%s", error); - wmem_free(NULL, error); + report_failure("while registering lua_fake_tap:\n%s",error->str); + g_string_free(error,TRUE); } else if (!dfilter_compile(fake_tap_filter->str, &wslua_dfilter, &err_msg)) { report_failure("while compiling dfilter \"%s\" for wslua: %s", fake_tap_filter->str, err_msg); g_free(err_msg); diff --git a/epan/wslua/wslua_listener.c b/epan/wslua/wslua_listener.c index 9d87ee5bbe..85caa7316c 100644 --- a/epan/wslua/wslua_listener.c +++ b/epan/wslua/wslua_listener.c @@ -210,7 +210,7 @@ WSLUA_CONSTRUCTOR Listener_new(lua_State* L) { const gchar* filter = luaL_optstring(L,WSLUA_OPTARG_Listener_new_FILTER,NULL); const gboolean all_fields = wslua_optbool(L, WSLUA_OPTARG_Listener_new_ALLFIELDS, FALSE); Listener tap; - gchar* error; + GString* error; tap = (Listener)g_malloc(sizeof(struct _wslua_tap)); @@ -237,8 +237,8 @@ WSLUA_CONSTRUCTOR Listener_new(lua_State* L) { g_free(tap->name); g_free(tap); /* WSLUA_ERROR(new_tap,"tap registration error"); */ - lua_pushfstring(L,"Error while registering tap:\n%s",error); - wmem_free(NULL, error); + lua_pushfstring(L,"Error while registering tap:\n%s",error->str); + g_string_free(error,TRUE); luaL_error(L,lua_tostring(L,-1)); } diff --git a/plugins/mate/packet-mate.c b/plugins/mate/packet-mate.c index 98267e5d4e..5ece48b188 100644 --- a/plugins/mate/packet-mate.c +++ b/plugins/mate/packet-mate.c @@ -327,7 +327,7 @@ extern void proto_reg_handoff_mate(void) { - gchar* tap_error = NULL; + GString* tap_error = NULL; if ( *pref_mate_config_filename != '\0' ) { @@ -354,8 +354,8 @@ proto_reg_handoff_mate(void) (tap_draw_cb) NULL); if ( tap_error ) { - g_warning("mate: couldn't (re)register tap: %s", tap_error); - wmem_free(NULL, tap_error); + g_warning("mate: couldn't (re)register tap: %s",tap_error->str); + g_string_free(tap_error, TRUE); mate_tap_data = 0; return; } diff --git a/rawshark.c b/rawshark.c index ee7d3b4ce0..cd59d9fdf9 100644 --- a/rawshark.c +++ b/rawshark.c @@ -1332,7 +1332,7 @@ protocolinfo_init(char *field) { pci_t *rs; header_field_info *hfi; - gchar *error_string; + GString *error_string; char hfibuf[100]; hfi=proto_registrar_get_byname(field); @@ -1356,8 +1356,8 @@ protocolinfo_init(char *field) if(error_string){ /* error, we failed to attach to the tap. complain and clean up */ fprintf(stderr, "rawshark: Couldn't register field extraction tap: %s\n", - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); if(rs->filter){ g_free(rs->filter); } diff --git a/tfshark.c b/tfshark.c index 653f7d826a..ae267614e6 100644 --- a/tfshark.c +++ b/tfshark.c @@ -913,6 +913,16 @@ main(int argc, char *argv[]) init_open_routines(); +#ifdef HAVE_PLUGINS + /* Register all the plugin types we have. */ + epan_register_plugin_types(); /* Types known to libwireshark */ + + /* Scan for plugins. This does *not* call their registration routines; + that's done later. */ + scan_plugins(); + +#endif + /* Register all dissectors; we must do this before checking for the "-G" flag, as the "-G" flag dumps information registered by the dissectors, and we must do it before we read the preferences, in diff --git a/tshark.c b/tshark.c index 3df60d4dd5..af38ab0702 100644 --- a/tshark.c +++ b/tshark.c @@ -1196,8 +1196,14 @@ main(int argc, char *argv[]) init_open_routines(); #ifdef HAVE_PLUGINS + /* Register all the plugin types we have. */ + epan_register_plugin_types(); /* Types known to libwireshark */ wtap_register_plugin_types(); /* Types known to libwiretap */ + /* Scan for plugins. This does *not* call their registration routines; + that's done later. */ + scan_plugins(); + /* Register all libwiretap plugin modules. */ register_all_wiretap_modules(); #endif diff --git a/ui/cli/tap-camelsrt.c b/ui/cli/tap-camelsrt.c index 7e64bf6449..6277d357d8 100644 --- a/ui/cli/tap-camelsrt.c +++ b/ui/cli/tap-camelsrt.c @@ -210,7 +210,7 @@ static void camelsrt_draw(void *phs) static void camelsrt_init(const char *opt_arg, void *userdata _U_) { struct camelsrt_t *p_camelsrt; - gchar *error_string; + GString *error_string; p_camelsrt = g_new(struct camelsrt_t, 1); if (!strncmp(opt_arg, "camel,srt,", 9)) { @@ -234,8 +234,8 @@ static void camelsrt_init(const char *opt_arg, void *userdata _U_) g_free(p_camelsrt); fprintf(stderr, "tshark: Couldn't register camel,srt tap: %s\n", - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); exit(1); } diff --git a/ui/cli/tap-comparestat.c b/ui/cli/tap-comparestat.c index e11b1a132d..286310103a 100644 --- a/ui/cli/tap-comparestat.c +++ b/ui/cli/tap-comparestat.c @@ -530,7 +530,7 @@ comparestat_init(const char *opt_arg, void *userdata _U_) { comparestat_t *cs; const char *filter = NULL; - gchar *error_string; + GString *error_string; gint start, stop, ttl, order, pos = 0; gdouble variance; @@ -581,8 +581,8 @@ comparestat_init(const char *opt_arg, void *userdata _U_) g_hash_table_destroy(cs->packet_set); g_free(cs); - fprintf(stderr, "tshark: Couldn't register compare tap: %s\n", error_string); - wmem_free(NULL, error_string); + fprintf(stderr, "tshark: Couldn't register compare tap: %s\n", error_string->str); + g_string_free(error_string, TRUE); exit(1); } } diff --git a/ui/cli/tap-diameter-avp.c b/ui/cli/tap-diameter-avp.c index 51223c8711..02106cd9f4 100644 --- a/ui/cli/tap-diameter-avp.c +++ b/ui/cli/tap-diameter-avp.c @@ -220,7 +220,7 @@ diameteravp_init(const char *opt_arg, void *userdata _U_) guint opt_count = 0; guint opt_idx = 0; GString *filter = NULL; - gchar *error_string = NULL; + GString *error_string = NULL; ds = g_new(diameteravp_t, 1); ds->frame = 0; @@ -263,8 +263,8 @@ diameteravp_init(const char *opt_arg, void *userdata _U_) g_free(ds); fprintf(stderr, "tshark: Couldn't register diam,csv tap: %s\n", - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); exit(1); } } diff --git a/ui/cli/tap-endpoints.c b/ui/cli/tap-endpoints.c index 9aec736047..5e261bd29b 100644 --- a/ui/cli/tap-endpoints.c +++ b/ui/cli/tap-endpoints.c @@ -113,7 +113,7 @@ endpoints_draw(void *arg) void init_hostlists(struct register_ct *ct, const char *filter) { endpoints_t *iu; - gchar *error_string; + GString *error_string; iu = g_new0(endpoints_t, 1); iu->type = proto_get_protocol_short_name(find_protocol_by_id(get_conversation_proto_id(ct))); @@ -124,8 +124,8 @@ void init_hostlists(struct register_ct *ct, const char *filter) if (error_string) { g_free(iu); fprintf(stderr, "tshark: Couldn't register endpoint tap: %s\n", - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); exit(1); } diff --git a/ui/cli/tap-expert.c b/ui/cli/tap-expert.c index be92d150dd..07fdfb5f6c 100644 --- a/ui/cli/tap-expert.c +++ b/ui/cli/tap-expert.c @@ -195,7 +195,7 @@ static void expert_stat_init(const char *opt_arg, void *userdata _U_) { const char *args = NULL; const char *filter = NULL; - gchar *error_string; + GString *error_string; expert_tapdata_t *hs; int n; @@ -257,8 +257,8 @@ static void expert_stat_init(const char *opt_arg, void *userdata _U_) expert_stat_packet, expert_stat_draw); if (error_string) { - printf("Expert tap error (%s)!\n", error_string); - wmem_free(NULL, error_string); + printf("Expert tap error (%s)!\n", error_string->str); + g_string_free(error_string, TRUE); g_free(hs); exit(1); } diff --git a/ui/cli/tap-follow.c b/ui/cli/tap-follow.c index cfce4a9c9c..9d2b2d0cc9 100644 --- a/ui/cli/tap-follow.c +++ b/ui/cli/tap-follow.c @@ -445,7 +445,7 @@ static void follow_stream(const char *opt_argp, void *userdata) { follow_info_t *follow_info; cli_follow_info_t* cli_follow_info; - gchar *errp; + GString *errp; register_follow_t* follower = (register_follow_t*)userdata; follow_index_filter_func index_filter; follow_address_filter_func address_filter; @@ -488,7 +488,7 @@ static void follow_stream(const char *opt_argp, void *userdata) if (errp != NULL) { follow_free(follow_info); - wmem_free(NULL, errp); + g_string_free(errp, TRUE); follow_exit("Error registering tap listener."); } } diff --git a/ui/cli/tap-gsm_astat.c b/ui/cli/tap-gsm_astat.c index 7dc26e3d07..8b5bb2b5ab 100644 --- a/ui/cli/tap-gsm_astat.c +++ b/ui/cli/tap-gsm_astat.c @@ -320,7 +320,7 @@ static void gsm_a_stat_init(const char *opt_arg _U_, void *userdata _U_) { gsm_a_stat_t *stat_p; - gchar *err_p; + GString *err_p; stat_p = g_new(gsm_a_stat_t, 1); @@ -335,7 +335,7 @@ gsm_a_stat_init(const char *opt_arg _U_, void *userdata _U_) if (err_p != NULL) { g_free(stat_p); - wmem_free(NULL, err_p); + g_string_free(err_p, TRUE); exit(1); } diff --git a/ui/cli/tap-hosts.c b/ui/cli/tap-hosts.c index 1837738b09..f81a9fc739 100644 --- a/ui/cli/tap-hosts.c +++ b/ui/cli/tap-hosts.c @@ -95,7 +95,7 @@ hosts_draw(void *dummy _U_) static void hosts_init(const char *opt_arg, void *userdata _U_) { - gchar *error_string; + GString *error_string; gchar **tokens; gint opt_count; @@ -128,8 +128,8 @@ hosts_init(const char *opt_arg, void *userdata _U_) if (error_string) { /* error, we failed to attach to the tap. clean up */ fprintf(stderr, "tshark: Couldn't register " TAP_NAME " tap: %s\n", - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); exit(1); } } diff --git a/ui/cli/tap-httpstat.c b/ui/cli/tap-httpstat.c index ae49a0fce8..6b7334b223 100644 --- a/ui/cli/tap-httpstat.c +++ b/ui/cli/tap-httpstat.c @@ -284,7 +284,7 @@ httpstat_init(const char *opt_arg, void *userdata _U_) { httpstat_t *sp; const char *filter = NULL; - gchar *error_string; + GString *error_string; if (!strncmp (opt_arg, "http,stat,", 10)) { filter = opt_arg+10; @@ -314,8 +314,8 @@ httpstat_init(const char *opt_arg, void *userdata _U_) g_free(sp->filter); g_free(sp); fprintf (stderr, "tshark: Couldn't register http,stat tap: %s\n", - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); exit(1); } diff --git a/ui/cli/tap-icmpstat.c b/ui/cli/tap-icmpstat.c index 6db273b0de..9102cf32fe 100644 --- a/ui/cli/tap-icmpstat.c +++ b/ui/cli/tap-icmpstat.c @@ -270,7 +270,7 @@ icmpstat_init(const char *opt_arg, void *userdata _U_) { icmpstat_t *icmpstat; const char *filter = NULL; - gchar *error_string; + GString *error_string; if (strstr(opt_arg, "icmp,srt,")) filter = opt_arg + strlen("icmp,srt,"); @@ -305,8 +305,8 @@ icmpstat_init(const char *opt_arg, void *userdata _U_) g_free(icmpstat); fprintf(stderr, "tshark: Couldn't register icmp,srt tap: %s\n", - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); exit(1); } } diff --git a/ui/cli/tap-icmpv6stat.c b/ui/cli/tap-icmpv6stat.c index 9c5d372684..6c2a59d0d7 100644 --- a/ui/cli/tap-icmpv6stat.c +++ b/ui/cli/tap-icmpv6stat.c @@ -271,7 +271,7 @@ icmpv6stat_init(const char *opt_arg, void *userdata _U_) { icmpv6stat_t *icmpv6stat; const char *filter = NULL; - gchar *error_string; + GString *error_string; if (strstr(opt_arg, "icmpv6,srt,")) filter = opt_arg + strlen("icmpv6,srt,"); @@ -306,8 +306,8 @@ icmpv6stat_init(const char *opt_arg, void *userdata _U_) g_free(icmpv6stat); fprintf(stderr, "tshark: Couldn't register icmpv6,srt tap: %s\n", - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); exit(1); } } diff --git a/ui/cli/tap-iostat.c b/ui/cli/tap-iostat.c index 5d3e6ee601..d481e1e898 100644 --- a/ui/cli/tap-iostat.c +++ b/ui/cli/tap-iostat.c @@ -1220,7 +1220,7 @@ iostat_draw(void *arg) static void register_io_tap(io_stat_t *io, int i, const char *filter) { - gchar *error_string; + GString *error_string; const char *flt; int j; size_t namelen; @@ -1372,8 +1372,8 @@ register_io_tap(io_stat_t *io, int i, const char *filter) g_free(io->items); g_free(io); fprintf(stderr, "\ntshark: Couldn't register io,stat tap: %s\n", - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); exit(1); } } diff --git a/ui/cli/tap-iousers.c b/ui/cli/tap-iousers.c index fb7e0d2f46..06f02697ac 100644 --- a/ui/cli/tap-iousers.c +++ b/ui/cli/tap-iousers.c @@ -215,7 +215,7 @@ iousers_draw(void *arg) void init_iousers(struct register_ct *ct, const char *filter) { io_users_t *iu; - gchar *error_string; + GString *error_string; iu = g_new0(io_users_t, 1); iu->type = proto_get_protocol_short_name(find_protocol_by_id(get_conversation_proto_id(ct))); @@ -226,8 +226,8 @@ void init_iousers(struct register_ct *ct, const char *filter) if (error_string) { g_free(iu); fprintf(stderr, "tshark: Couldn't register conversations tap: %s\n", - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); exit(1); } diff --git a/ui/cli/tap-macltestat.c b/ui/cli/tap-macltestat.c index d5afbdd4eb..c50dab9a87 100644 --- a/ui/cli/tap-macltestat.c +++ b/ui/cli/tap-macltestat.c @@ -517,7 +517,7 @@ static void mac_lte_stat_init(const char *opt_arg, void *userdata _U_) { mac_lte_stat_t *hs; const char *filter = NULL; - gchar *error_string; + GString *error_string; /* Check for a filter string */ if (strncmp(opt_arg, "mac-lte,stat,", 13) == 0) { @@ -539,7 +539,7 @@ static void mac_lte_stat_init(const char *opt_arg, void *userdata _U_) mac_lte_stat_packet, mac_lte_stat_draw); if (error_string) { - wmem_free(NULL, error_string); + g_string_free(error_string, TRUE); g_free(hs); exit(1); } diff --git a/ui/cli/tap-protocolinfo.c b/ui/cli/tap-protocolinfo.c index 8be62703ee..23581bc127 100644 --- a/ui/cli/tap-protocolinfo.c +++ b/ui/cli/tap-protocolinfo.c @@ -87,7 +87,7 @@ protocolinfo_init(const char *opt_arg, void *userdata _U_) const char *field = NULL; const char *filter = NULL; header_field_info *hfi; - gchar *error_string; + GString *error_string; if (!strncmp("proto,colinfo,", opt_arg, 14)) { filter = opt_arg+14; @@ -120,8 +120,8 @@ protocolinfo_init(const char *opt_arg, void *userdata _U_) if (error_string) { /* error, we failed to attach to the tap. complain and clean up */ fprintf(stderr, "tshark: Couldn't register proto,colinfo tap: %s\n", - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); g_free(rs->filter); g_free(rs); diff --git a/ui/cli/tap-protohierstat.c b/ui/cli/tap-protohierstat.c index 24d8365c46..6fe4096a69 100644 --- a/ui/cli/tap-protohierstat.c +++ b/ui/cli/tap-protohierstat.c @@ -170,7 +170,7 @@ protohierstat_init(const char *opt_arg, void *userdata _U_) phs_t *rs; int pos = 0; const char *filter = NULL; - gchar *error_string; + GString *error_string; if (strcmp("io,phs", opt_arg) == 0) { /* No arguments */ @@ -198,8 +198,8 @@ protohierstat_init(const char *opt_arg, void *userdata _U_) g_free(rs); fprintf(stderr, "tshark: Couldn't register io,phs tap: %s\n", - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); exit(1); } } diff --git a/ui/cli/tap-rlcltestat.c b/ui/cli/tap-rlcltestat.c index 1cbe48eb4e..546d2a246a 100644 --- a/ui/cli/tap-rlcltestat.c +++ b/ui/cli/tap-rlcltestat.c @@ -365,7 +365,7 @@ static void rlc_lte_stat_init(const char *opt_arg, void *userdata _U_) { rlc_lte_stat_t *hs; const char *filter = NULL; - gchar *error_string; + GString *error_string; /* Check for a filter string */ if (strncmp(opt_arg, "rlc-lte,stat,", 13) == 0) { @@ -392,7 +392,7 @@ static void rlc_lte_stat_init(const char *opt_arg, void *userdata _U_) rlc_lte_stat_packet, rlc_lte_stat_draw); if (error_string) { - wmem_free(NULL, error_string); + g_string_free(error_string, TRUE); g_free(hs); exit(1); } diff --git a/ui/cli/tap-rpcprogs.c b/ui/cli/tap-rpcprogs.c index ee2c9e7b77..798062087d 100644 --- a/ui/cli/tap-rpcprogs.c +++ b/ui/cli/tap-rpcprogs.c @@ -211,7 +211,7 @@ rpcprogs_draw(void *dummy _U_) static void rpcprogs_init(const char *opt_arg _U_, void *userdata _U_) { - gchar *error_string; + GString *error_string; if (already_enabled) { return; @@ -221,8 +221,8 @@ rpcprogs_init(const char *opt_arg _U_, void *userdata _U_) error_string = register_tap_listener("rpc", NULL, NULL, 0, NULL, rpcprogs_packet, rpcprogs_draw); if (error_string) { fprintf(stderr, "tshark: Couldn't register rpc,programs tap: %s\n", - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); exit(1); } } diff --git a/ui/cli/tap-rtd.c b/ui/cli/tap-rtd.c index c37d02713a..2e43286b62 100644 --- a/ui/cli/tap-rtd.c +++ b/ui/cli/tap-rtd.c @@ -102,7 +102,7 @@ rtd_draw(void *arg) static void init_rtd_tables(register_rtd_t* rtd, const char *filter) { - gchar *error_string; + GString *error_string; rtd_t* ui; ui = g_new0(rtd_t, 1); @@ -116,8 +116,8 @@ init_rtd_tables(register_rtd_t* rtd, const char *filter) error_string = register_tap_listener(get_rtd_tap_listener_name(rtd), &ui->rtd, filter, 0, NULL, get_rtd_packet_func(rtd), rtd_draw); if (error_string) { free_rtd_table(&ui->rtd.stat_table, NULL, NULL); - fprintf(stderr, "tshark: Couldn't register srt tap: %s\n", error_string); - wmem_free(NULL, error_string); + fprintf(stderr, "tshark: Couldn't register srt tap: %s\n", error_string->str); + g_string_free(error_string, TRUE); exit(1); } } diff --git a/ui/cli/tap-rtp.c b/ui/cli/tap-rtp.c index 230f356087..71243474de 100644 --- a/ui/cli/tap-rtp.c +++ b/ui/cli/tap-rtp.c @@ -139,7 +139,7 @@ rtp_streams_stat_draw(void *arg _U_) static void rtp_streams_stat_init(const char *opt_arg _U_, void *userdata _U_) { - gchar *err_p; + GString *err_p; err_p = register_tap_listener("rtp", &the_tapinfo_struct, NULL, 0, @@ -149,7 +149,7 @@ rtp_streams_stat_init(const char *opt_arg _U_, void *userdata _U_) if (err_p != NULL) { - wmem_free(NULL, err_p); + g_string_free(err_p, TRUE); exit(1); } diff --git a/ui/cli/tap-rtspstat.c b/ui/cli/tap-rtspstat.c index d91167a30d..20d15e4640 100644 --- a/ui/cli/tap-rtspstat.c +++ b/ui/cli/tap-rtspstat.c @@ -236,7 +236,7 @@ rtspstat_init(const char *opt_arg, void *userdata _U_) { rtspstat_t *sp; const char *filter = NULL; - gchar *error_string; + GString *error_string; if (!strncmp (opt_arg, "rtsp,stat,", 10)) { filter = opt_arg+10; @@ -266,8 +266,8 @@ rtspstat_init(const char *opt_arg, void *userdata _U_) g_free(sp->filter); g_free(sp); fprintf (stderr, "tshark: Couldn't register rtsp,stat tap: %s\n", - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); exit(1); } diff --git a/ui/cli/tap-sctpchunkstat.c b/ui/cli/tap-sctpchunkstat.c index cb8efdc42b..2d41d362ae 100644 --- a/ui/cli/tap-sctpchunkstat.c +++ b/ui/cli/tap-sctpchunkstat.c @@ -198,7 +198,7 @@ static void sctpstat_init(const char *opt_arg, void *userdata _U_) { sctpstat_t *hs; - gchar *error_string; + GString *error_string; hs = (sctpstat_t *)g_malloc(sizeof(sctpstat_t)); if (!strncmp(opt_arg, "sctp,stat,", 11)) { @@ -218,8 +218,8 @@ sctpstat_init(const char *opt_arg, void *userdata _U_) g_free(hs); fprintf(stderr, "tshark: Couldn't register sctp,stat tap: %s\n", - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); exit(1); } } diff --git a/ui/cli/tap-simple_stattable.c b/ui/cli/tap-simple_stattable.c index d722ba2f0f..9f52eb458d 100644 --- a/ui/cli/tap-simple_stattable.c +++ b/ui/cli/tap-simple_stattable.c @@ -103,7 +103,7 @@ simple_draw(void *arg) static void init_stat_table(stat_tap_table_ui *new_stat_tap, const char *filter) { - gchar *error_string; + GString *error_string; table_stat_t* ui; ui = g_new0(table_stat_t, 1); @@ -116,8 +116,8 @@ init_stat_table(stat_tap_table_ui *new_stat_tap, const char *filter) error_string = register_tap_listener(new_stat_tap->tap_name, &ui->stats, filter, 0, NULL, new_stat_tap->packet_func, simple_draw); if (error_string) { /* free_rtd_table(&ui->rtd.stat_table, NULL, NULL); */ - fprintf(stderr, "tshark: Couldn't register tap: %s\n", error_string); - wmem_free(NULL, error_string); + fprintf(stderr, "tshark: Couldn't register tap: %s\n", error_string->str); + g_string_free(error_string, TRUE); exit(1); } } diff --git a/ui/cli/tap-sipstat.c b/ui/cli/tap-sipstat.c index bac6b0f4f5..a7936102db 100644 --- a/ui/cli/tap-sipstat.c +++ b/ui/cli/tap-sipstat.c @@ -394,7 +394,7 @@ sipstat_init(const char *opt_arg, void *userdata _U_) { sipstat_t *sp; const char *filter = NULL; - gchar *error_string; + GString *error_string; if (strncmp (opt_arg, "sip,stat,", 9) == 0) { filter = opt_arg+9; @@ -424,8 +424,8 @@ sipstat_init(const char *opt_arg, void *userdata _U_) g_free(sp->filter); g_free(sp); fprintf (stderr, "tshark: Couldn't register sip,stat tap: %s\n", - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); exit(1); } diff --git a/ui/cli/tap-smbsids.c b/ui/cli/tap-smbsids.c index ce6f3f6be9..0234281e28 100644 --- a/ui/cli/tap-smbsids.c +++ b/ui/cli/tap-smbsids.c @@ -66,7 +66,7 @@ smbsids_draw(void *pss _U_) static void smbsids_init(const char *opt_arg _U_, void *userdata _U_) { - gchar *error_string; + GString *error_string; if (!sid_name_snooping) { fprintf(stderr, "The -z smb,sids function needs SMB/SID-Snooping to be enabled.\n"); @@ -81,8 +81,8 @@ smbsids_init(const char *opt_arg _U_, void *userdata _U_) error_string = register_tap_listener("smb", NULL, NULL, 0, NULL, smbsids_packet, smbsids_draw); if (error_string) { fprintf(stderr, "tshark: Couldn't register smb,sids tap:%s\n", - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); exit(1); } } diff --git a/ui/cli/tap-srt.c b/ui/cli/tap-srt.c index d6a965e484..32fde53594 100644 --- a/ui/cli/tap-srt.c +++ b/ui/cli/tap-srt.c @@ -118,7 +118,7 @@ static void init_srt_tables(register_srt_t* srt, const char *filter) { srt_t *ui; - gchar *error_string; + GString *error_string; ui = g_new0(srt_t, 1); ui->type = proto_get_protocol_short_name(find_protocol_by_id(get_srt_proto_id(srt))); @@ -130,8 +130,8 @@ init_srt_tables(register_srt_t* srt, const char *filter) if (error_string) { free_srt_table(srt, global_srt_array, NULL, NULL); g_free(ui); - fprintf(stderr, "tshark: Couldn't register srt tap: %s\n", error_string); - wmem_free(NULL, error_string); + fprintf(stderr, "tshark: Couldn't register srt tap: %s\n", error_string->str); + g_string_free(error_string, TRUE); exit(1); } } diff --git a/ui/cli/tap-stats_tree.c b/ui/cli/tap-stats_tree.c index fedf22da3b..f30a5dc23b 100644 --- a/ui/cli/tap-stats_tree.c +++ b/ui/cli/tap-stats_tree.c @@ -64,7 +64,7 @@ static void init_stats_tree(const char *opt_arg, void *userdata _U_) { char *abbr = stats_tree_get_abbr(opt_arg); - gchar *error_string; + GString *error_string; stats_tree_cfg *cfg = NULL; stats_tree *st = NULL; @@ -99,8 +99,7 @@ init_stats_tree(const char *opt_arg, void *userdata _U_) draw_stats_tree); if (error_string) { - report_failure("stats_tree for: %s failed to attach to the tap: %s", cfg->name, error_string); - wmem_free(NULL, error_string); + report_failure("stats_tree for: %s failed to attach to the tap: %s", cfg->name, error_string->str); return; } diff --git a/ui/cli/tap-sv.c b/ui/cli/tap-sv.c index 731fe42a67..c7a43ef294 100644 --- a/ui/cli/tap-sv.c +++ b/ui/cli/tap-sv.c @@ -56,7 +56,7 @@ sv_packet(void *prs _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const void static void svstat_init(const char *opt_arg _U_, void *userdata _U_) { - gchar *error_string; + GString *error_string; error_string = register_tap_listener( "sv", @@ -69,8 +69,8 @@ svstat_init(const char *opt_arg _U_, void *userdata _U_) if (error_string) { /* error, we failed to attach to the tap. clean up */ fprintf(stderr, "tshark: Couldn't register sv,stat tap: %s\n", - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); exit(1); } } diff --git a/ui/cli/tap-wspstat.c b/ui/cli/tap-wspstat.c index f65280bbbe..b2a0ba46a8 100644 --- a/ui/cli/tap-wspstat.c +++ b/ui/cli/tap-wspstat.c @@ -216,7 +216,7 @@ wspstat_init(const char *opt_arg, void *userdata _U_) wspstat_t *sp; const char *filter = NULL; guint32 i; - gchar *error_string; + GString *error_string; wsp_status_code_t *sc; const value_string *wsp_vals_status_p; @@ -272,8 +272,8 @@ wspstat_init(const char *opt_arg, void *userdata _U_) g_hash_table_foreach( sp->hash, (GHFunc) wsp_free_hash_table, NULL ) ; g_hash_table_destroy( sp->hash ); fprintf(stderr, "tshark: Couldn't register wsp,stat tap: %s\n", - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); exit(1); } } diff --git a/ui/gtk/compare_stat.c b/ui/gtk/compare_stat.c index fe2c5e634a..7239d5bace 100644 --- a/ui/gtk/compare_stat.c +++ b/ui/gtk/compare_stat.c @@ -699,7 +699,7 @@ gtk_comparestat_init(const char *opt_arg, void* userdata _U_) gdouble variance; gint start, stop,ttl, order, pos=0; const char *filter=NULL; - gchar *error_string; + GString *error_string; if(sscanf(opt_arg,"compare,%d,%d,%d,%d,%lf%n",&start, &stop, &ttl, &order, &variance, &pos)==5){ if(*(opt_arg+pos)==',') @@ -791,8 +791,8 @@ gtk_comparestat_init(const char *opt_arg, void* userdata _U_) error_string=register_tap_listener("ip", cs, filter, 0, comparestat_reset, comparestat_packet, comparestat_draw); if(error_string){ - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string); - wmem_free(NULL, error_string); + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str); + g_string_free(error_string, TRUE); gtk_tree_store_clear(cs->simple_list); g_hash_table_destroy(cs->packet_set); g_hash_table_destroy(cs->ip_id_set); diff --git a/ui/gtk/conversations_table.c b/ui/gtk/conversations_table.c index 4927220aa5..7fc02e2eb0 100644 --- a/ui/gtk/conversations_table.c +++ b/ui/gtk/conversations_table.c @@ -70,7 +70,7 @@ reset_ct_table_data(conversations_table *ct) { char *display_name; char title[256]; - gchar *error_string; + GString *error_string; const char *filter; GtkListStore *store; @@ -82,8 +82,8 @@ reset_ct_table_data(conversations_table *ct) error_string = set_tap_dfilter (&ct->hash, filter); if (error_string) { - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string); - wmem_free(NULL, error_string); + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str); + g_string_free(error_string, TRUE); return; } @@ -1925,7 +1925,7 @@ init_ct_table_page(conversations_table *conversations, GtkWidget *vbox, gboolean tap_packet_cb packet_func) { int i; - gchar *error_string; + GString *error_string; char title[256]; GtkListStore *store; @@ -2059,8 +2059,8 @@ init_ct_table_page(conversations_table *conversations, GtkWidget *vbox, gboolean error_string=register_tap_listener(tap_name, &conversations->hash, filter, 0, reset_ct_table_data_cb, packet_func, draw_ct_table_data_cb); if(error_string){ - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string); - wmem_free(NULL, error_string); + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str); + g_string_free(error_string, TRUE); return FALSE; } diff --git a/ui/gtk/dcerpc_stat.c b/ui/gtk/dcerpc_stat.c index a846f9c609..e9186fdda7 100644 --- a/ui/gtk/dcerpc_stat.c +++ b/ui/gtk/dcerpc_stat.c @@ -146,7 +146,7 @@ gtk_dcerpcstat_init(const char *opt_arg, void* userdata _U_) int pos = 0; const char *filter = NULL; dcerpcstat_tap_data_t* tap_data; - gchar *error_string; + GString *error_string; /* * XXX - DCE RPC statistics are maintained only by major version, @@ -260,8 +260,8 @@ gtk_dcerpcstat_init(const char *opt_arg, void* userdata _U_) error_string = register_tap_listener("dcerpc", &rs->data, filter, 0, dcerpcstat_reset, get_srt_packet_func(rs->srt), dcerpcstat_draw); if(error_string){ /* error, we failed to attach to the tap. clean up */ - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string); - wmem_free(NULL, error_string); + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str); + g_string_free(error_string, TRUE); free_srt_table(rs->srt, rs->data.srt_array, NULL, NULL); g_free(rs); return; diff --git a/ui/gtk/expert_comp_dlg.c b/ui/gtk/expert_comp_dlg.c index 8087b47dda..9450bbbbae 100644 --- a/ui/gtk/expert_comp_dlg.c +++ b/ui/gtk/expert_comp_dlg.c @@ -143,7 +143,7 @@ expert_comp_select_filter_cb(GtkWidget *widget, gpointer callback_data, guint ca { expert_comp_dlg_t *ss = (expert_comp_dlg_t *)callback_data; const char *filter; - gchar *error_string; + GString *error_string; ss->use_dfilter = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (widget)); if (ss->use_dfilter) { @@ -153,14 +153,14 @@ expert_comp_select_filter_cb(GtkWidget *widget, gpointer callback_data, guint ca } error_string = set_tap_dfilter (ss, filter); if (error_string) { - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string); - wmem_free(NULL, error_string); + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str); + g_string_free(error_string, TRUE); return; } error_string = set_tap_dfilter (ss->etd, filter); if (error_string) { - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string); - wmem_free(NULL, error_string); + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str); + g_string_free(error_string, TRUE); return; } @@ -791,7 +791,7 @@ static void expert_comp_init(const char *opt_arg _U_, void* userdata _U_) { expert_comp_dlg_t *ss; - gchar *error_string; + GString *error_string; GtkWidget *temp_page, *details_page, *comments_page; GtkWidget *main_nb; GtkWidget *vbox; @@ -950,8 +950,8 @@ expert_comp_init(const char *opt_arg _U_, void* userdata _U_) expert_dlg_packet, expert_dlg_draw); if(error_string){ - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string); - wmem_free(NULL, error_string); + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str); + g_string_free(error_string, TRUE); g_free(ss->etd); return; } @@ -964,8 +964,8 @@ expert_comp_init(const char *opt_arg _U_, void* userdata _U_) error_string=register_tap_listener("expert", ss, NULL, TL_REQUIRES_NOTHING, error_reset, error_packet, expert_comp_draw); if(error_string){ - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string); - wmem_free(NULL, error_string); + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str); + g_string_free(error_string, TRUE); g_free(ss); return; } diff --git a/ui/gtk/export_object_dlg.c b/ui/gtk/export_object_dlg.c index 4233480632..ee1c3af8b3 100644 --- a/ui/gtk/export_object_dlg.c +++ b/ui/gtk/export_object_dlg.c @@ -322,7 +322,7 @@ export_object_window(const gchar *tapname, const gchar *name, tap_packet_cb tap_ GtkTreeViewColumn *column; GtkTreeSelection *selection; GtkWidget *vbox, *bbox, *help_bt, *cancel_bt, *save_bt, *save_all_bt; - gchar *error_msg; + GString *error_msg; export_object_list_t *object_list; gchar *window_title; @@ -340,8 +340,8 @@ export_object_window(const gchar *tapname, const gchar *name, tap_packet_cb tap_ if (error_msg) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "Can't register %s tap: %s\n", name, error_msg); - wmem_free(NULL, error_msg); + "Can't register %s tap: %s\n", name, error_msg->str); + g_string_free(error_msg, TRUE); g_free(object_list); return; } diff --git a/ui/gtk/follow_stream.c b/ui/gtk/follow_stream.c index ad1e6b8d26..d12a6234c0 100644 --- a/ui/gtk/follow_stream.c +++ b/ui/gtk/follow_stream.c @@ -170,7 +170,7 @@ static void follow_stream_cb(register_follow_t* follower, follow_read_stream_fun gchar *both_directions_string = NULL; follow_info_t *follow_info; gtk_follow_info_t *gtk_follow_info; - gchar *msg; + GString *msg; gboolean is_follow = FALSE; guint32 ignore_stream; char stream_window_title[256]; @@ -232,12 +232,11 @@ static void follow_stream_cb(register_follow_t* follower, follow_read_stream_fun if (msg) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Can't register %s tap: %s\n", - get_follow_tap_string(follower), msg); + get_follow_tap_string(follower), msg->str); g_free(gtk_follow_info); g_free(follow_info->filter_out_filter); g_free(follow_info); g_free(follow_filter); - wmem_free(NULL, msg); return; } diff --git a/ui/gtk/gsm_map_summary.c b/ui/gtk/gsm_map_summary.c index 1f261c0fcf..15fd6b9644 100644 --- a/ui/gtk/gsm_map_summary.c +++ b/ui/gtk/gsm_map_summary.c @@ -396,7 +396,7 @@ gsm_map_summary_packet( void register_tap_listener_gtk_gsm_map_summary(void) { - gchar *err_p; + GString *err_p; memset((void *) &gsm_map_stat, 0, sizeof(gsm_map_stat_t)); @@ -408,8 +408,8 @@ register_tap_listener_gtk_gsm_map_summary(void) if (err_p != NULL) { - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_p); - wmem_free(NULL, err_p); + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_p->str); + g_string_free(err_p, TRUE); exit(1); } diff --git a/ui/gtk/hostlist_table.c b/ui/gtk/hostlist_table.c index 1f72114a68..e65f227392 100644 --- a/ui/gtk/hostlist_table.c +++ b/ui/gtk/hostlist_table.c @@ -75,7 +75,7 @@ reset_host_table_data(hostlist_table *hosts) { char *display_name; char title[256]; - gchar *error_string; + GString *error_string; const char *filter; GtkListStore *store; @@ -86,8 +86,8 @@ reset_host_table_data(hostlist_table *hosts) } error_string = set_tap_dfilter (&hosts->hash, filter); if (error_string) { - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string); - wmem_free(NULL, error_string); + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str); + g_string_free(error_string, TRUE); return; } @@ -850,7 +850,7 @@ init_hostlist_table_page(hostlist_table *hosttable, GtkWidget *vbox, gboolean hi const char *filter, tap_packet_cb packet_func) { guint i; - gchar *error_string; + GString *error_string; char title[256]; GtkListStore *store; GtkWidget *tree; @@ -1009,8 +1009,8 @@ init_hostlist_table_page(hostlist_table *hosttable, GtkWidget *vbox, gboolean hi /* register the tap and rerun the taps on the packet list */ error_string=register_tap_listener(tap_name, &hosttable->hash, filter, 0, reset_hostlist_table_data_cb, packet_func, draw_hostlist_table_data_cb); if(error_string){ - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string); - wmem_free(NULL, error_string); + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str); + g_string_free(error_string, TRUE); g_free(hosttable); return FALSE; } diff --git a/ui/gtk/iax2_analysis.c b/ui/gtk/iax2_analysis.c index 1cf3b256ea..604f721ba3 100644 --- a/ui/gtk/iax2_analysis.c +++ b/ui/gtk/iax2_analysis.c @@ -1864,7 +1864,7 @@ static void on_refresh_bt_clicked(GtkWidget *bt _U_, gpointer data) { user_data_t *user_data = (user_data_t *)data; - gchar *error_string; + GString *error_string; /* remove tap listener */ remove_tap_listener(user_data); @@ -1873,8 +1873,8 @@ on_refresh_bt_clicked(GtkWidget *bt _U_, gpointer data) error_string = register_tap_listener("IAX2", user_data, NULL, 0, iax2_reset, iax2_packet, iax2_draw); if (error_string != NULL) { - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string); - wmem_free(NULL, error_string); + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str); + g_string_free(error_string, TRUE); return; } diff --git a/ui/gtk/io_stat.c b/ui/gtk/io_stat.c index 6853d2116b..b077429d56 100644 --- a/ui/gtk/io_stat.c +++ b/ui/gtk/io_stat.c @@ -1068,11 +1068,11 @@ tap_iostat_draw(void *g) be able to pick up the field values after the edt tree has been pruned */ -static gchar * +static GString * enable_graph(io_stat_graph_t *gio, const char *filter, const char *field) { GString *real_filter = NULL; - gchar *err_msg; + GString *err_msg; gio->display = TRUE; @@ -1155,7 +1155,7 @@ iostat_init(const char *opt_arg _U_, void* userdata _U_) {1.0, 0.314, 1.0, 1.0} /* Light brilliant magenta */ }; - gchar *error_string; + GString *error_string; io = g_new(io_stat_t,1); io->needs_redraw = TRUE; diff --git a/ui/gtk/lbm_stream_dlg.c b/ui/gtk/lbm_stream_dlg.c index df99266756..d3fea45ce1 100644 --- a/ui/gtk/lbm_stream_dlg.c +++ b/ui/gtk/lbm_stream_dlg.c @@ -738,7 +738,7 @@ static void lbmc_stream_dlg_tap_draw(void * tap_data _U_) /**************************************************************/ void lbmc_stream_dlg_stream_menu_cb(gpointer arg _U_) { - gchar * err_msg; + GString * err_msg; if (global_stream_dialog_info != NULL) { @@ -755,8 +755,8 @@ void lbmc_stream_dlg_stream_menu_cb(gpointer arg _U_) lbmc_stream_dlg_tap_draw); if (err_msg != NULL) { - fprintf(stderr, "register_tap_listener: %s\n", err_msg); - wmem_free(NULL, err_msg); + fprintf(stderr, "register_tap_listener: %s\n", err_msg->str); + g_string_free(err_msg, TRUE); } cf_retap_packets(&cfile); } diff --git a/ui/gtk/lbm_uimflow_dlg.c b/ui/gtk/lbm_uimflow_dlg.c index 5ed9e3b625..b0993547b6 100644 --- a/ui/gtk/lbm_uimflow_dlg.c +++ b/ui/gtk/lbm_uimflow_dlg.c @@ -241,7 +241,7 @@ static void lbmc_uim_flow_graph_on_ok_cb(GtkButton * button _U_, gpointer user_d /* Scan for displayed packets (retap all packets) */ if (dialog_data.have_tap_listener == FALSE) { - gchar * err_msg; + GString * err_msg; err_msg = register_tap_listener("lbm_uim", &(dialog_data.tap_identifier), @@ -252,8 +252,8 @@ static void lbmc_uim_flow_graph_on_ok_cb(GtkButton * button _U_, gpointer user_d lbmc_uim_flow_tap_draw); if (err_msg != NULL) { - fprintf(stderr, "register_tap_listener: %s\n", err_msg); - wmem_free(NULL, err_msg); + fprintf(stderr, "register_tap_listener: %s\n", err_msg->str); + g_string_free(err_msg, TRUE); } dialog_data.have_tap_listener = TRUE; } diff --git a/ui/gtk/mac_lte_stat_dlg.c b/ui/gtk/mac_lte_stat_dlg.c index af2e3b0bcb..3057e3e8c2 100644 --- a/ui/gtk/mac_lte_stat_dlg.c +++ b/ui/gtk/mac_lte_stat_dlg.c @@ -1003,7 +1003,7 @@ static void gtk_mac_lte_stat_init(const char *opt_arg, void *userdata _U_) { mac_lte_stat_t *hs; const char *filter = NULL; - gchar *error_string; + GString *error_string; GtkWidget *ues_scrolled_window; GtkWidget *bbox; GtkWidget *top_level_vbox; @@ -1366,8 +1366,8 @@ static void gtk_mac_lte_stat_init(const char *opt_arg, void *userdata _U_) mac_lte_stat_packet, mac_lte_stat_draw); if (error_string) { - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string); - wmem_free(NULL, error_string); + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str); + g_string_free(error_string, TRUE); g_free(hs); return; } diff --git a/ui/gtk/main.c b/ui/gtk/main.c index cd390eca85..bcad63b05b 100644 --- a/ui/gtk/main.c +++ b/ui/gtk/main.c @@ -2296,9 +2296,14 @@ main(int argc, char *argv[]) #ifdef HAVE_PLUGINS /* Register all the plugin types we have. */ + epan_register_plugin_types(); /* Types known to libwireshark */ wtap_register_plugin_types(); /* Types known to libwiretap */ codec_register_plugin_types(); /* Types known to libwscodecs */ + /* Scan for plugins. This does *not* call their registration routines; + that's done later. */ + scan_plugins(); + /* Register all libwiretap plugin modules. */ register_all_wiretap_modules(); diff --git a/ui/gtk/mtp3_summary.c b/ui/gtk/mtp3_summary.c index c45bc48ba5..1917720449 100644 --- a/ui/gtk/mtp3_summary.c +++ b/ui/gtk/mtp3_summary.c @@ -530,7 +530,7 @@ mtp3_summary_packet( void register_tap_listener_gtk_mtp3_summary(void) { - gchar *err_p; + GString *err_p; memset((void *) &mtp3_stat, 0, sizeof(mtp3_stat)); @@ -542,8 +542,8 @@ register_tap_listener_gtk_mtp3_summary(void) if (err_p != NULL) { - simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK, "%s", err_p); - wmem_free(NULL, err_p); + simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK, "%s", err_p->str); + g_string_free(err_p, TRUE); exit(1); } diff --git a/ui/gtk/response_time_delay_table.c b/ui/gtk/response_time_delay_table.c index fde0258083..fb110fe018 100644 --- a/ui/gtk/response_time_delay_table.c +++ b/ui/gtk/response_time_delay_table.c @@ -275,7 +275,7 @@ init_rtd_tables(register_rtd_t* rtd, const char *filter) { rtd_t *rr; gchar *str; - gchar *error_string; + GString *error_string; GtkWidget *bbox; GtkWidget *close_bt; @@ -304,8 +304,8 @@ init_rtd_tables(register_rtd_t* rtd, const char *filter) error_string = register_tap_listener(get_rtd_tap_listener_name(rtd), &rr->data, filter, 0, rtd_reset, get_rtd_packet_func(rtd), rtd_draw); if(error_string){ - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string); - wmem_free(NULL, error_string); + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str); + g_string_free(error_string, TRUE); free_rtd_table(&rr->data.stat_table, NULL, NULL); g_free(rr); return; diff --git a/ui/gtk/rlc_lte_stat_dlg.c b/ui/gtk/rlc_lte_stat_dlg.c index 55aced9fa0..6ff23b3ccd 100644 --- a/ui/gtk/rlc_lte_stat_dlg.c +++ b/ui/gtk/rlc_lte_stat_dlg.c @@ -1257,7 +1257,7 @@ static void gtk_rlc_lte_stat_init(const char *opt_arg, void *userdata _U_) { rlc_lte_stat_t *hs; const char *filter = NULL; - gchar *error_string; + GString *error_string; GtkWidget *ues_scrolled_window; GtkWidget *channels_scrolled_window; GtkWidget *bbox; @@ -1615,8 +1615,8 @@ static void gtk_rlc_lte_stat_init(const char *opt_arg, void *userdata _U_) rlc_lte_stat_packet, rlc_lte_stat_draw); if (error_string) { - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string); - wmem_free(NULL, error_string); + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str); + g_string_free(error_string, TRUE); g_free(hs); return; } diff --git a/ui/gtk/rpc_stat.c b/ui/gtk/rpc_stat.c index 5b068a4418..cf18aa910e 100644 --- a/ui/gtk/rpc_stat.c +++ b/ui/gtk/rpc_stat.c @@ -191,7 +191,7 @@ gtk_rpcstat_init(const char *opt_arg, void* userdata _U_) GtkWidget *close_bt; int program, version, pos; const char *filter=NULL; - gchar *error_string; + GString *error_string; rpcstat_tap_data_t* tap_data; pos=0; @@ -263,8 +263,8 @@ gtk_rpcstat_init(const char *opt_arg, void* userdata _U_) error_string=register_tap_listener("rpc", &rs->data, filter, 0, rpcstat_reset, get_srt_packet_func(rs->srt), rpcstat_draw); if(error_string){ - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string); - wmem_free(NULL, error_string); + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str); + g_string_free(error_string, TRUE); free_srt_table(rs->srt, rs->data.srt_array, NULL, NULL); g_free(rs); return; diff --git a/ui/gtk/rtp_analysis.c b/ui/gtk/rtp_analysis.c index a9cb508007..daaa6d38e8 100644 --- a/ui/gtk/rtp_analysis.c +++ b/ui/gtk/rtp_analysis.c @@ -2038,7 +2038,7 @@ static void draw_stat(user_data_t *user_data); static void on_refresh_bt_clicked(GtkWidget *bt _U_, user_data_t *user_data) { - gchar *error_string; + GString *error_string; /* remove tap listener */ remove_tap_listener(user_data); @@ -2047,8 +2047,8 @@ on_refresh_bt_clicked(GtkWidget *bt _U_, user_data_t *user_data) error_string = register_tap_listener("rtp", user_data, NULL, 0, rtp_reset, rtp_packet, rtp_draw); if (error_string != NULL) { - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string); - wmem_free(NULL, error_string); + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str); + g_string_free(error_string, TRUE); return; } diff --git a/ui/gtk/sctp_chunk_stat.c b/ui/gtk/sctp_chunk_stat.c index cbb516df62..edb5de543d 100644 --- a/ui/gtk/sctp_chunk_stat.c +++ b/ui/gtk/sctp_chunk_stat.c @@ -263,7 +263,7 @@ static void sctpstat_init(const char *opt_arg, void *userdata _U_) { sctpstat_t *hs; - gchar *error_string; + GString *error_string; GtkWidget *bbox; GtkWidget *close_bt; @@ -296,8 +296,8 @@ sctpstat_init(const char *opt_arg, void *userdata _U_) sctpstat_packet, sctpstat_draw); if(error_string){ - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string); - wmem_free(NULL, error_string); + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str); + g_string_free(error_string, TRUE); g_free(hs->filter); g_free(hs); return; diff --git a/ui/gtk/service_response_time_table.c b/ui/gtk/service_response_time_table.c index de4692b58a..c1f615849a 100644 --- a/ui/gtk/service_response_time_table.c +++ b/ui/gtk/service_response_time_table.c @@ -699,7 +699,7 @@ init_srt_tables(register_srt_t* srt, const char *filter) gchar *str; GtkWidget *label; char *filter_string, *tmp_filter_string; - gchar *error_string; + GString *error_string; GtkWidget *bbox; GtkWidget *close_bt; @@ -762,8 +762,8 @@ init_srt_tables(register_srt_t* srt, const char *filter) error_string = register_tap_listener(get_srt_tap_listener_name(srt), &ss->data, filter, 0, srt_reset, get_srt_packet_func(srt), srt_draw); if(error_string){ - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string); - wmem_free(NULL, error_string); + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str); + g_string_free(error_string, TRUE); free_srt_table(ss->srt, ss->data.srt_array, NULL, NULL); g_free(ss); return; diff --git a/ui/gtk/simple_stattable.c b/ui/gtk/simple_stattable.c index a7d60ecd95..669815d916 100644 --- a/ui/gtk/simple_stattable.c +++ b/ui/gtk/simple_stattable.c @@ -196,7 +196,7 @@ static void init_simple_stat_tables(stat_tap_table_ui *new_stat_tap, const char *filter) { simple_stat_t *ss; - gchar *error_string; + GString *error_string; GtkWidget *bbox; GtkWidget *close_bt; @@ -221,8 +221,8 @@ init_simple_stat_tables(stat_tap_table_ui *new_stat_tap, const char *filter) error_string = register_tap_listener(new_stat_tap->tap_name, &ss->data, filter, 0, simple_stat_reset, new_stat_tap->packet_func, simple_stat_draw); if(error_string){ - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string); - wmem_free(NULL, error_string); + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str); + g_string_free(error_string, TRUE); free_stat_tables(ss->new_stat_tap, NULL, NULL); g_free(ss); return; diff --git a/ui/gtk/stats_tree_stat.c b/ui/gtk/stats_tree_stat.c index 85e8f977fb..7979540f7f 100644 --- a/ui/gtk/stats_tree_stat.c +++ b/ui/gtk/stats_tree_stat.c @@ -399,7 +399,7 @@ init_gtk_tree(const char* opt_arg, void *userdata _U_) tree_pres* pr = (tree_pres *)g_malloc(sizeof(tree_pres)); gchar* title = NULL; gchar* window_name = NULL; - gchar* error_string; + GString* error_string; GtkWidget *scr_win; size_t init_strlen; GtkWidget *main_vb, *bbox, *bt_close, *bt_copy, *bt_saveas; @@ -510,8 +510,8 @@ init_gtk_tree(const char* opt_arg, void *userdata _U_) if (error_string) { /* error, we failed to attach to the tap. clean up */ /* destroy_stat_tree_window(st); */ - report_failure("stats_tree for: %s failed to attach to the tap: %s",cfg->name,error_string); - wmem_free(NULL, error_string); + report_failure("stats_tree for: %s failed to attach to the tap: %s",cfg->name,error_string->str); + g_string_free(error_string, TRUE); } /* Button row. */ diff --git a/ui/gtk/wlan_stat_dlg.c b/ui/gtk/wlan_stat_dlg.c index ec23d36cd4..9cd9b86181 100644 --- a/ui/gtk/wlan_stat_dlg.c +++ b/ui/gtk/wlan_stat_dlg.c @@ -158,7 +158,7 @@ wlanstat_reset (void *phs) wlan_ep_t *list = wlan_stat->ep_list; char *display_name; char title[256]; - gchar *error_string; + GString *error_string; GtkListStore *store; const char *filter = NULL; @@ -176,8 +176,8 @@ wlanstat_reset (void *phs) error_string = set_tap_dfilter (wlan_stat, filter); if (error_string) { - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string); - wmem_free(NULL, error_string); + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str); + g_string_free(error_string, TRUE); return; } @@ -1745,7 +1745,7 @@ static void wlanstat_dlg_create (void) { wlanstat_t *hs; - gchar *error_string; + GString *error_string; GtkWidget *scrolled_window; GtkWidget *bbox; GtkWidget *vbox; @@ -1918,8 +1918,8 @@ wlanstat_dlg_create (void) wlanstat_reset, wlanstat_packet, wlanstat_draw); if (error_string) { - simple_dialog (ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string); - wmem_free(NULL, error_string); + simple_dialog (ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str); + g_string_free (error_string, TRUE); g_free (hs); return; } diff --git a/ui/mcast_stream.c b/ui/mcast_stream.c index 4daca8b7d2..badc1fcf36 100644 --- a/ui/mcast_stream.c +++ b/ui/mcast_stream.c @@ -259,7 +259,7 @@ mcaststream_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const /* increment the packets counter for this stream and calculate average pps */ ++(strinfo->npackets); - + if (deltatime > 0) { strinfo->apackets = strinfo->npackets / deltatime; strinfo->average_bw = ((double)(strinfo->total_bytes*8) / deltatime); @@ -332,7 +332,7 @@ remove_tap_listener_mcast_stream(mcaststream_tapinfo_t *tapinfo) void register_tap_listener_mcast_stream(mcaststream_tapinfo_t *tapinfo) { - gchar *error_string; + GString *error_string; if (!tapinfo) { return; @@ -345,8 +345,8 @@ register_tap_listener_mcast_stream(mcaststream_tapinfo_t *tapinfo) if (error_string != NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "%s", error_string); - wmem_free(NULL, error_string); + "%s", error_string->str); + g_string_free(error_string, TRUE); exit(1); } diff --git a/ui/qt/bluetooth_device_dialog.cpp b/ui/qt/bluetooth_device_dialog.cpp index a3a50d99f9..5c72f2d2a4 100644 --- a/ui/qt/bluetooth_device_dialog.cpp +++ b/ui/qt/bluetooth_device_dialog.cpp @@ -96,7 +96,7 @@ bluetooth_device_tap_reset(void *tapinfo_ptr) static void bluetooth_devices_tap(void *data) { - gchar *error_string; + GString *error_string; error_string = register_tap_listener("bluetooth.device", data, NULL, 0, @@ -107,8 +107,8 @@ bluetooth_devices_tap(void *data) if (error_string != NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "%s", error_string); - g_free(error_string); + "%s", error_string->str); + g_string_free(error_string, TRUE); } } diff --git a/ui/qt/bluetooth_hci_summary_dialog.cpp b/ui/qt/bluetooth_hci_summary_dialog.cpp index 87aad65e67..a29d3f8136 100644 --- a/ui/qt/bluetooth_hci_summary_dialog.cpp +++ b/ui/qt/bluetooth_hci_summary_dialog.cpp @@ -79,7 +79,7 @@ bluetooth_device_tap_reset(void *tapinfo_ptr) static void bluetooth_devices_tap(void *data) { - gchar *error_string; + GString *error_string; error_string = register_tap_listener("bluetooth.hci_summary", data, NULL, 0, @@ -90,8 +90,8 @@ bluetooth_devices_tap(void *data) if (error_string != NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "%s", error_string); - wmem_free(NULL, error_string); + "%s", error_string->str); + g_string_free(error_string, TRUE); } } diff --git a/ui/qt/expert_info_dialog.cpp b/ui/qt/expert_info_dialog.cpp index 7dfb3101a5..ea19f1f60f 100644 --- a/ui/qt/expert_info_dialog.cpp +++ b/ui/qt/expert_info_dialog.cpp @@ -312,11 +312,11 @@ void ExpertInfoDialog::retapPackets() } if (ui->limitCheckBox->isChecked()) { - gchar *error_string = set_tap_dfilter(this, display_filter_.toUtf8().constData()); + GString *error_string = set_tap_dfilter(this, display_filter_.toUtf8().constData()); if (error_string) { QMessageBox::warning(this, tr("Endpoint expert failed to set filter"), - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); return; } } diff --git a/ui/qt/gsm_map_summary_dialog.cpp b/ui/qt/gsm_map_summary_dialog.cpp index 2ad0c5c0c1..3265068e94 100644 --- a/ui/qt/gsm_map_summary_dialog.cpp +++ b/ui/qt/gsm_map_summary_dialog.cpp @@ -371,7 +371,7 @@ gsm_map_summary_packet(void *tapdata, packet_info *, epan_dissect_t *, const voi void register_tap_listener_qt_gsm_map_summary(void) { - gchar *err_p; + GString *err_p; memset((void *) &gsm_map_stat, 0, sizeof(gsm_map_stat_t)); @@ -383,8 +383,8 @@ register_tap_listener_qt_gsm_map_summary(void) if (err_p != NULL) { - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_p); - wmem_free(NULL, err_p); + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_p->str); + g_string_free(err_p, TRUE); exit(1); } diff --git a/ui/qt/io_graph_dialog.cpp b/ui/qt/io_graph_dialog.cpp index 3b18fffb0d..7270d49572 100644 --- a/ui/qt/io_graph_dialog.cpp +++ b/ui/qt/io_graph_dialog.cpp @@ -1650,7 +1650,7 @@ IOGraph::IOGraph(QCustomPlot *parent) : graph_ = parent_->addGraph(parent_->xAxis, parent_->yAxis); Q_ASSERT(graph_ != NULL); - gchar *error_string; + GString *error_string; error_string = register_tap_listener("frame", this, "", @@ -1661,7 +1661,7 @@ IOGraph::IOGraph(QCustomPlot *parent) : if (error_string) { // QMessageBox::critical(this, tr("%1 failed to register tap listener").arg(name_), // error_string->str); - wmem_free(NULL, error_string); + g_string_free(error_string, TRUE); } setFilter(QString()); @@ -1682,7 +1682,6 @@ IOGraph::~IOGraph() { void IOGraph::setFilter(const QString &filter) { GString *error_string; - gchar* filter_error_string; QString full_filter(filter.trimmed()); config_err_.clear(); @@ -1720,10 +1719,10 @@ void IOGraph::setFilter(const QString &filter) } } - filter_error_string = set_tap_dfilter(this, full_filter.toUtf8().constData()); - if (filter_error_string) { - config_err_ = filter_error_string; - wmem_free(NULL, filter_error_string); + error_string = set_tap_dfilter(this, full_filter.toUtf8().constData()); + if (error_string) { + config_err_ = error_string->str; + g_string_free(error_string, TRUE); return; } else { if (filter_.compare(filter) && visible_) { diff --git a/ui/qt/lbm_lbtrm_transport_dialog.cpp b/ui/qt/lbm_lbtrm_transport_dialog.cpp index 87a8b03b08..b232f927ed 100644 --- a/ui/qt/lbm_lbtrm_transport_dialog.cpp +++ b/ui/qt/lbm_lbtrm_transport_dialog.cpp @@ -1295,7 +1295,7 @@ void LBMLBTRMTransportDialog::resetReceiversDetail(void) void LBMLBTRMTransportDialog::fillTree(void) { - gchar * error_string; + GString * error_string; if (m_capture_file == NULL) { @@ -1313,8 +1313,8 @@ void LBMLBTRMTransportDialog::fillTree(void) if (error_string) { QMessageBox::critical(this, tr("LBT-RM Statistics failed to attach to tap"), - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); reject(); } diff --git a/ui/qt/lbm_lbtru_transport_dialog.cpp b/ui/qt/lbm_lbtru_transport_dialog.cpp index 65982b2d73..a787b12808 100644 --- a/ui/qt/lbm_lbtru_transport_dialog.cpp +++ b/ui/qt/lbm_lbtru_transport_dialog.cpp @@ -1715,7 +1715,7 @@ void LBMLBTRUTransportDialog::resetReceiversDetail(void) void LBMLBTRUTransportDialog::fillTree(void) { - gchar * error_string; + GString * error_string; if (m_capture_file == NULL) { @@ -1733,8 +1733,8 @@ void LBMLBTRUTransportDialog::fillTree(void) if (error_string) { QMessageBox::critical(this, tr("LBT-RU Statistics failed to attach to tap"), - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); reject(); } diff --git a/ui/qt/lbm_stream_dialog.cpp b/ui/qt/lbm_stream_dialog.cpp index 1aa90d8b90..000527a679 100644 --- a/ui/qt/lbm_stream_dialog.cpp +++ b/ui/qt/lbm_stream_dialog.cpp @@ -372,7 +372,7 @@ void LBMStreamDialog::setCaptureFile(capture_file * cfile) void LBMStreamDialog::fillTree(void) { - gchar * error_string; + GString * error_string; if (m_capture_file == NULL) { @@ -390,8 +390,8 @@ void LBMStreamDialog::fillTree(void) if (error_string) { QMessageBox::critical(this, tr("LBM Stream failed to attach to tap"), - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); reject(); } diff --git a/ui/qt/mtp3_summary_dialog.cpp b/ui/qt/mtp3_summary_dialog.cpp index 2611238469..f009f939e9 100644 --- a/ui/qt/mtp3_summary_dialog.cpp +++ b/ui/qt/mtp3_summary_dialog.cpp @@ -371,7 +371,7 @@ mtp3_summary_packet( void register_tap_listener_qt_mtp3_summary(void) { - gchar *err_p; + GString *err_p; memset((void *) &mtp3_stat, 0, sizeof(mtp3_stat)); @@ -383,8 +383,8 @@ register_tap_listener_qt_mtp3_summary(void) if (err_p != NULL) { - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_p); - wmem_free(NULL, err_p); + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_p->str); + g_string_free(err_p, TRUE); exit(1); } diff --git a/ui/qt/wireshark_dialog.cpp b/ui/qt/wireshark_dialog.cpp index 37066f8e0a..ba5cd12bb1 100644 --- a/ui/qt/wireshark_dialog.cpp +++ b/ui/qt/wireshark_dialog.cpp @@ -116,12 +116,12 @@ void WiresharkDialog::updateWidgets() bool WiresharkDialog::registerTapListener(const char *tap_name, void *tap_data, const char *filter, guint flags, void(*tap_reset)(void *), gboolean(*tap_packet)(void *, struct _packet_info *, struct epan_dissect *, const void *), void(*tap_draw)(void *)) { - gchar *error_string = register_tap_listener(tap_name, tap_data, filter, flags, + GString *error_string = register_tap_listener(tap_name, tap_data, filter, flags, tap_reset, tap_packet, tap_draw); if (error_string) { QMessageBox::warning(this, tr("Failed to attach to tap \"%1\"").arg(tap_name), - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); return false; } diff --git a/ui/rtp_stream.c b/ui/rtp_stream.c index afaf678a25..01b6198345 100644 --- a/ui/rtp_stream.c +++ b/ui/rtp_stream.c @@ -193,7 +193,7 @@ remove_tap_listener_rtp_stream(rtpstream_tapinfo_t *tapinfo) void register_tap_listener_rtp_stream(rtpstream_tapinfo_t *tapinfo, const char *fstring) { - gchar *error_string; + GString *error_string; if (!tapinfo) { return; @@ -206,8 +206,8 @@ register_tap_listener_rtp_stream(rtpstream_tapinfo_t *tapinfo, const char *fstri if (error_string != NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "%s", error_string); - wmem_free(NULL, error_string); + "%s", error_string->str); + g_string_free(error_string, TRUE); exit(1); } diff --git a/ui/tap-rlc-graph.c b/ui/tap-rlc-graph.c index 38980f991a..e5bb6cfeb5 100644 --- a/ui/tap-rlc-graph.c +++ b/ui/tap-rlc-graph.c @@ -114,7 +114,7 @@ rlc_lte_tap_info *select_rlc_lte_session(capture_file *cf, epan_dissect_t edt; dfilter_t *sfcode; - gchar *error_string; + GString *error_string; nstime_t rel_ts; /* Initialised to no known channels */ th_t th = {0, {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}}; @@ -139,8 +139,8 @@ rlc_lte_tap_info *select_rlc_lte_session(capture_file *cf, error_string = register_tap_listener("rlc-lte", &th, NULL, 0, NULL, tap_lte_rlc_packet, NULL); if (error_string){ fprintf(stderr, "wireshark: Couldn't register rlc_lte_graph tap: %s\n", - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); exit(1); /* XXX: fix this */ } @@ -250,7 +250,7 @@ gboolean rlc_graph_segment_list_get(capture_file *cf, struct rlc_graph *g, gbool char **err_string) { struct rlc_segment current; - gchar *error_string; + GString *error_string; g_log(NULL, G_LOG_LEVEL_DEBUG, "graph_segment_list_get()"); @@ -283,8 +283,8 @@ gboolean rlc_graph_segment_list_get(capture_file *cf, struct rlc_graph *g, gbool error_string = register_tap_listener("rlc-lte", g, "rlc-lte", 0, NULL, rlc_lte_tap_for_graph_data, NULL); if (error_string) { fprintf(stderr, "wireshark: Couldn't register rlc_graph tap: %s\n", - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); exit(1); /* XXX: fix this */ } cf_retap_packets(cf); diff --git a/ui/tap-sctp-analysis.c b/ui/tap-sctp-analysis.c index 3ace8546a1..d5e6faf179 100644 --- a/ui/tap-sctp-analysis.c +++ b/ui/tap-sctp-analysis.c @@ -1239,13 +1239,13 @@ sctp_stat_get_info(void) void register_tap_listener_sctp_stat(void) { - gchar *error_string; + GString *error_string; if (!sctp_tapinfo_struct.is_registered) { if ((error_string = register_tap_listener("sctp", &sctp_tapinfo_struct, NULL, 0, reset, packet, NULL))) { - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string); - wmem_free(NULL, error_string); + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str); + g_string_free(error_string, TRUE); return; } sctp_tapinfo_struct.is_registered=TRUE; diff --git a/ui/tap-tcp-stream.c b/ui/tap-tcp-stream.c index 7e40785cf9..abf357683d 100644 --- a/ui/tap-tcp-stream.c +++ b/ui/tap-tcp-stream.c @@ -116,7 +116,7 @@ void graph_segment_list_get(capture_file *cf, struct tcp_graph *tg, gboolean stream_known) { struct segment current; - gchar *error_string; + GString *error_string; tcp_scan_t ts; g_log(NULL, G_LOG_LEVEL_DEBUG, "graph_segment_list_get()"); @@ -152,8 +152,8 @@ graph_segment_list_get(capture_file *cf, struct tcp_graph *tg, gboolean stream_k error_string = register_tap_listener("tcp", &ts, "tcp", 0, NULL, tapall_tcpip_packet, NULL); if (error_string) { fprintf(stderr, "wireshark: Couldn't register tcp_graph tap: %s\n", - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); exit(1); /* XXX: fix this */ } cf_retap_packets(cf); @@ -288,7 +288,7 @@ select_tcpip_session(capture_file *cf, struct segment *hdrs) epan_dissect_t edt; dfilter_t *sfcode; gchar *err_msg; - gchar *error_string; + GString *error_string; nstime_t rel_ts; th_t th = {0, {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}}; @@ -312,8 +312,8 @@ select_tcpip_session(capture_file *cf, struct segment *hdrs) error_string=register_tap_listener("tcp", &th, NULL, 0, NULL, tap_tcpip_packet, NULL); if (error_string) { fprintf(stderr, "wireshark: Couldn't register tcp_graph tap: %s\n", - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); exit(1); } diff --git a/ui/tap_export_pdu.c b/ui/tap_export_pdu.c index 87420435c3..a151e72567 100644 --- a/ui/tap_export_pdu.c +++ b/ui/tap_export_pdu.c @@ -177,11 +177,13 @@ exp_pdu_close(exp_pdu_t *exp_pdu_tap_data) char * exp_pdu_pre_open(const char *tap_name, const char *filter, exp_pdu_t *exp_pdu_tap_data) { + GString *error_string; + /* XXX: can we always assume WTAP_ENCAP_WIRESHARK_UPPER_PDU? */ exp_pdu_tap_data->pkt_encap = wtap_wtap_encap_to_pcap_encap(WTAP_ENCAP_WIRESHARK_UPPER_PDU); /* Register this tap listener now */ - return register_tap_listener(tap_name, /* The name of the tap we want to listen to */ + error_string = register_tap_listener(tap_name, /* The name of the tap we want to listen to */ exp_pdu_tap_data, /* instance identifier/pointer to a struct holding * all state variables */ filter, /* pointer to a filter string */ @@ -189,6 +191,10 @@ exp_pdu_pre_open(const char *tap_name, const char *filter, exp_pdu_t *exp_pdu_ta NULL, export_pdu_packet, NULL); + if (error_string != NULL) + return g_string_free(error_string, FALSE); + + return NULL; } diff --git a/ui/voip_calls.c b/ui/voip_calls.c index 2f180b3adc..609ead9fba 100644 --- a/ui/voip_calls.c +++ b/ui/voip_calls.c @@ -532,7 +532,7 @@ rtp_event_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt _ void rtp_event_init_tap(voip_calls_tapinfo_t *tap_id_base) { - gchar *error_string; + GString *error_string; error_string = register_tap_listener("rtpevent", tap_base_to_id(tap_id_base, tap_id_offset_rtp_event_), NULL, @@ -544,8 +544,8 @@ rtp_event_init_tap(voip_calls_tapinfo_t *tap_id_base) if (error_string != NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "%s", error_string); - wmem_free(NULL, error_string); + "%s", error_string->str); + g_string_free(error_string, TRUE); } } @@ -840,7 +840,7 @@ rtp_packet_draw(void *tap_offset_ptr) void rtp_init_tap(voip_calls_tapinfo_t *tap_id_base) { - gchar *error_string; + GString *error_string; error_string = register_tap_listener("rtp", tap_base_to_id(tap_id_base, tap_id_offset_rtp_), NULL, 0, @@ -850,8 +850,8 @@ rtp_init_tap(voip_calls_tapinfo_t *tap_id_base) ); if (error_string != NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "%s", error_string); - wmem_free(NULL, error_string); + "%s", error_string->str); + g_string_free(error_string, TRUE); } } @@ -1036,7 +1036,7 @@ t38_draw(void *tap_offset_ptr) void t38_init_tap(voip_calls_tapinfo_t *tap_id_base) { - gchar *error_string; + GString *error_string; error_string = register_tap_listener("t38", tap_base_to_id(tap_id_base, tap_id_offset_t38_), NULL, 0, @@ -1046,8 +1046,8 @@ t38_init_tap(voip_calls_tapinfo_t *tap_id_base) ); if (error_string != NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "%s", error_string); - wmem_free(NULL, error_string); + "%s", error_string->str); + g_string_free(error_string, TRUE); } } @@ -1267,7 +1267,7 @@ sip_calls_draw(void *tap_offset_ptr) void sip_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) { - gchar *error_string; + GString *error_string; error_string = register_tap_listener("sip", tap_base_to_id(tap_id_base, tap_id_offset_sip_), NULL, 0, @@ -1277,8 +1277,8 @@ sip_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) ); if (error_string != NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "%s", error_string); - wmem_free(NULL, error_string); + "%s", error_string->str); + g_string_free(error_string, TRUE); } } @@ -1470,7 +1470,7 @@ isup_calls_draw(void *tap_offset_ptr) void isup_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) { - gchar *error_string; + GString *error_string; error_string = register_tap_listener("isup", tap_base_to_id(tap_id_base, tap_id_offset_isup_), NULL, @@ -1482,8 +1482,8 @@ isup_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) if (error_string != NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "%s", error_string); - wmem_free(NULL, error_string); + "%s", error_string->str); + g_string_free(error_string, TRUE); } } @@ -1523,7 +1523,7 @@ mtp3_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt void mtp3_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) { - gchar *error_string; + GString *error_string; error_string = register_tap_listener("mtp3", tap_base_to_id(tap_id_base, tap_id_offset_mtp3_), NULL, @@ -1535,8 +1535,8 @@ mtp3_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) if (error_string != NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "%s", error_string); - wmem_free(NULL, error_string); + "%s", error_string->str); + g_string_free(error_string, TRUE); } error_string = register_tap_listener("m3ua", tap_base_to_id(tap_id_base, tap_id_offset_m3ua_), @@ -1549,8 +1549,8 @@ mtp3_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) if (error_string != NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "%s", error_string); - wmem_free(NULL, error_string); + "%s", error_string->str); + g_string_free(error_string, TRUE); } } @@ -1851,7 +1851,7 @@ q931_calls_draw(void *tap_offset_ptr) void q931_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) { - gchar *error_string; + GString *error_string; error_string = register_tap_listener("q931", tap_base_to_id(tap_id_base, tap_id_offset_q931_), NULL, @@ -1863,8 +1863,8 @@ q931_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) if (error_string != NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "%s", error_string); - wmem_free(NULL, error_string); + "%s", error_string->str); + g_string_free(error_string, TRUE); } } @@ -2144,7 +2144,7 @@ h225_calls_draw(void *tap_offset_ptr) void h225_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) { - gchar *error_string; + GString *error_string; error_string = register_tap_listener("h225", tap_base_to_id(tap_id_base, tap_id_offset_h225_), NULL, 0, @@ -2155,8 +2155,8 @@ h225_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) if (error_string != NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "%s", error_string); - wmem_free(NULL, error_string); + "%s", error_string->str); + g_string_free(error_string, TRUE); } } @@ -2304,7 +2304,7 @@ h245dg_calls_draw(void *tap_offset_ptr) void h245dg_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) { - gchar *error_string; + GString *error_string; if (!tap_id_base->h245_labels) { tap_id_base->h245_labels = g_new0(h245_labels_t, 1); @@ -2319,8 +2319,8 @@ h245dg_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) if (error_string != NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "%s", error_string); - wmem_free(NULL, error_string); + "%s", error_string->str); + g_string_free(error_string, TRUE); } } @@ -2378,7 +2378,7 @@ sdp_calls_draw(void *tap_offset_ptr) void sdp_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) { - gchar *error_string; + GString *error_string; error_string = register_tap_listener("sdp", tap_base_to_id(tap_id_base, tap_id_offset_sdp_), NULL, 0, @@ -2389,8 +2389,8 @@ sdp_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) if (error_string != NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "%s", error_string); - wmem_free(NULL, error_string); + "%s", error_string->str); + g_string_free(error_string, TRUE); } } @@ -2752,7 +2752,7 @@ mgcp_calls_draw(void *tap_offset_ptr) void mgcp_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) { - gchar *error_string; + GString *error_string; /* * We set TL_REQUIRES_PROTO_TREE to force a non-null "tree" @@ -2770,8 +2770,8 @@ mgcp_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) ); if (error_string != NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "%s", error_string); - wmem_free(NULL, error_string); + "%s", error_string->str); + g_string_free(error_string, TRUE); } } @@ -2885,7 +2885,7 @@ actrace_calls_draw(void *tap_offset_ptr) void actrace_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) { - gchar *error_string; + GString *error_string; error_string = register_tap_listener("actrace", tap_base_to_id(tap_id_base, tap_id_offset_actrace_), NULL, 0, @@ -2896,8 +2896,8 @@ actrace_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) if (error_string != NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "%s", error_string); - wmem_free(NULL, error_string); + "%s", error_string->str); + g_string_free(error_string, TRUE); } } @@ -3056,7 +3056,7 @@ megaco_calls_draw(void *tap_offset_ptr) void h248_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) { - gchar *error_string; + GString *error_string; error_string = register_tap_listener("megaco", tap_base_to_id(tap_id_base, tap_id_offset_megaco_), NULL, @@ -3067,8 +3067,8 @@ h248_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) if (error_string != NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "%s", error_string); - wmem_free(NULL, error_string); + "%s", error_string->str); + g_string_free(error_string, TRUE); } error_string = register_tap_listener("h248", tap_base_to_id(tap_id_base, tap_id_offset_h248_), @@ -3080,8 +3080,8 @@ h248_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) if (error_string != NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "%s", error_string); - wmem_free(NULL, error_string); + "%s", error_string->str); + g_string_free(error_string, TRUE); } } @@ -3249,7 +3249,7 @@ sua_calls_draw(void *tap_offset_ptr) void sccp_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) { - gchar *error_string; + GString *error_string; error_string = register_tap_listener("sccp", tap_base_to_id(tap_id_base, tap_id_offset_sccp_), NULL, @@ -3260,8 +3260,8 @@ void sccp_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) if (error_string != NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "%s", error_string); - wmem_free(NULL, error_string); + "%s", error_string->str); + g_string_free(error_string, TRUE); } error_string = register_tap_listener("sua", tap_base_to_id(tap_id_base, tap_id_offset_sua_), @@ -3273,8 +3273,8 @@ void sccp_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) if (error_string != NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "%s", error_string); - wmem_free(NULL, error_string); + "%s", error_string->str); + g_string_free(error_string, TRUE); } } @@ -3772,7 +3772,7 @@ unistim_calls_draw(void *tap_offset_ptr) void unistim_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) { - gchar *error_string; + GString *error_string; error_string = register_tap_listener("unistim", tap_base_to_id(tap_id_base, tap_id_offset_unistim_), NULL, @@ -3784,8 +3784,8 @@ unistim_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) { if (error_string != NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "%s", error_string); - wmem_free(NULL, error_string); + "%s", error_string->str); + g_string_free(error_string, TRUE); } } @@ -3933,7 +3933,7 @@ skinny_calls_draw(void *tap_offset_ptr) void skinny_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) { - gchar *error_string; + GString *error_string; /* * We set TL_REQUIRES_PROTO_TREE to force a non-null "tree" @@ -3951,8 +3951,8 @@ skinny_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) ); if (error_string != NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "%s", error_string); - wmem_free(NULL, error_string); + "%s", error_string->str); + g_string_free(error_string, TRUE); } } @@ -4072,7 +4072,7 @@ iax2_calls_draw(void *tap_offset_ptr) void iax2_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) { - gchar *error_string; + GString *error_string; /* * We set TL_REQUIRES_PROTO_TREE to force a non-null "tree" @@ -4093,8 +4093,8 @@ iax2_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) ); if (error_string != NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", - error_string); - wmem_free(NULL, error_string); + error_string->str); + g_string_free(error_string, TRUE); } } @@ -4195,7 +4195,7 @@ voip_calls_draw(void *tap_offset_ptr) void voip_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) { - gchar *error_string; + GString *error_string; error_string = register_tap_listener("voip", tap_base_to_id(tap_id_base, tap_id_offset_voip_), NULL, @@ -4207,8 +4207,8 @@ voip_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) if (error_string != NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "%s", error_string); - wmem_free(NULL, error_string); + "%s", error_string->str); + g_string_free(error_string, TRUE); } } diff --git a/wireshark-qt.cpp b/wireshark-qt.cpp index 094b482b49..6b54f99f5b 100644 --- a/wireshark-qt.cpp +++ b/wireshark-qt.cpp @@ -540,16 +540,6 @@ int main(int argc, char *argv[]) init_open_routines(); - /* Register all dissectors; we must do this before checking for the - "-G" flag, as the "-G" flag dumps information registered by the - dissectors, and we must do it before we read the preferences, in - case any dissectors register preferences. */ - if (!epan_init(register_all_protocols,register_all_protocol_handoffs, - splash_update, NULL)) { - SimpleDialog::displayQueuedMessages(main_w); - return 2; - } - #ifdef HAVE_PLUGINS /* Register all the plugin types we have. */ epan_register_plugin_types(); /* Types known to libwireshark */ @@ -567,6 +557,16 @@ int main(int argc, char *argv[]) register_all_codecs(); #endif + /* Register all dissectors; we must do this before checking for the + "-G" flag, as the "-G" flag dumps information registered by the + dissectors, and we must do it before we read the preferences, in + case any dissectors register preferences. */ + if (!epan_init(register_all_protocols,register_all_protocol_handoffs, + splash_update, NULL)) { + SimpleDialog::displayQueuedMessages(main_w); + return 2; + } + splash_update(RA_LISTENERS, NULL, NULL); /* Register all tap listeners; we do this before we parse the arguments, -- cgit v1.2.3