Don't call g_string_free() with bool - it takes gboolean

This commit is contained in:
Stig Bjørlykke 2024-07-05 08:04:12 +02:00 committed by AndersBroman
parent a0c8344f16
commit fb89750e32
113 changed files with 211 additions and 211 deletions

View File

@ -188,7 +188,7 @@ void capture_process_finished(capture_session *cap_session)
} }
cap_session->closed(cap_session, message->str); cap_session->closed(cap_session, message->str);
g_string_free(message, true); g_string_free(message, TRUE);
g_free(capture_opts->closed_msg); g_free(capture_opts->closed_msg);
capture_opts->closed_msg = NULL; capture_opts->closed_msg = NULL;
capture_opts->stop_after_extcaps = false; capture_opts->stop_after_extcaps = false;
@ -348,7 +348,7 @@ sync_pipe_open_command(char **argv, int *data_read_fd,
/* We can't return anything */ /* We can't return anything */
g_strfreev(argv); g_strfreev(argv);
#ifdef _WIN32 #ifdef _WIN32
g_string_free(args, true); g_string_free(args, TRUE);
#endif #endif
return -1; return -1;
} }
@ -543,7 +543,7 @@ sync_pipe_open_command(char **argv, int *data_read_fd,
ws_close(message_read_fd); /* Should close sync_pipe[PIPE_READ] */ ws_close(message_read_fd); /* Should close sync_pipe[PIPE_READ] */
CloseHandle(sync_pipe[PIPE_WRITE]); CloseHandle(sync_pipe[PIPE_WRITE]);
g_strfreev(argv); g_strfreev(argv);
g_string_free(args, true); g_string_free(args, TRUE);
g_free(handles); g_free(handles);
return -1; return -1;
} }
@ -551,7 +551,7 @@ sync_pipe_open_command(char **argv, int *data_read_fd,
/* We may need to store this and close it later */ /* We may need to store this and close it later */
CloseHandle(pi.hThread); CloseHandle(pi.hThread);
g_strfreev(argv); g_strfreev(argv);
g_string_free(args, true); g_string_free(args, TRUE);
g_free(handles); g_free(handles);
if (signal_write_fd != NULL) { if (signal_write_fd != NULL) {
@ -1202,7 +1202,7 @@ sync_pipe_run_command_actual(char **argv, char **data, char **primary_msg,
*/ */
*primary_msg = msg; *primary_msg = msg;
*secondary_msg = NULL; *secondary_msg = NULL;
g_string_free(data_buf, true); g_string_free(data_buf, TRUE);
*data = NULL; *data = NULL;
} else { } else {
/* /*
@ -1210,7 +1210,7 @@ sync_pipe_run_command_actual(char **argv, char **data, char **primary_msg,
*/ */
*primary_msg = NULL; *primary_msg = NULL;
*secondary_msg = NULL; *secondary_msg = NULL;
*data = g_string_free(data_buf, false); *data = g_string_free(data_buf, FALSE);
} }
break; break;

View File

@ -255,7 +255,7 @@ static char* conversation_element_list_values(conversation_element_t *elements)
break; break;
} }
} }
return g_string_free(value_str, false); return g_string_free(value_str, FALSE);
} }
#endif #endif

View File

@ -74,7 +74,7 @@ dissector_conversation_init(const char *opt_arg, void* userdata)
filter = opt_arg + cmd_str->len + 1; filter = opt_arg + cmd_str->len + 1;
} }
} }
g_string_free(cmd_str, true); g_string_free(cmd_str, TRUE);
if (table->conv_gui_init) if (table->conv_gui_init)
table->conv_gui_init(table, filter); table->conv_gui_init(table, filter);
@ -96,7 +96,7 @@ dissector_endpoint_init(const char *opt_arg, void* userdata)
filter=NULL; filter=NULL;
} }
g_string_free(cmd_str, true); g_string_free(cmd_str, TRUE);
if (table->endpoint_gui_init) if (table->endpoint_gui_init)
table->endpoint_gui_init(table, filter); table->endpoint_gui_init(table, filter);
@ -152,7 +152,7 @@ set_conv_gui_data(const void *key _U_, void *value, void *userdata)
g_string_append(conv_cmd_str, proto_get_protocol_filter_name(table->proto_id)); g_string_append(conv_cmd_str, proto_get_protocol_filter_name(table->proto_id));
ui_info.group = REGISTER_STAT_GROUP_CONVERSATION_LIST; ui_info.group = REGISTER_STAT_GROUP_CONVERSATION_LIST;
ui_info.title = NULL; /* construct this from the protocol info? */ ui_info.title = NULL; /* construct this from the protocol info? */
ui_info.cli_string = g_string_free(conv_cmd_str, false); ui_info.cli_string = g_string_free(conv_cmd_str, FALSE);
ui_info.tap_init_cb = dissector_conversation_init; ui_info.tap_init_cb = dissector_conversation_init;
ui_info.nparams = 0; ui_info.nparams = 0;
ui_info.params = NULL; ui_info.params = NULL;

View File

@ -2950,7 +2950,7 @@ parse_key_string(char* input_string, uint8_t key_type, char** error)
g_string_append_printf(err_string, "%u, ", allowed_key_lengths[i]); g_string_append_printf(err_string, "%u, ", allowed_key_lengths[i]);
} }
g_string_append_printf(err_string, "or %u bytes.", allowed_key_lengths[i]); g_string_append_printf(err_string, "or %u bytes.", allowed_key_lengths[i]);
*error = g_string_free(err_string, false); *error = g_string_free(err_string, FALSE);
} }
g_byte_array_free(key_ba, true); g_byte_array_free(key_ba, true);
return NULL; return NULL;

View File

@ -79,7 +79,7 @@ static char* dfilter_macro_resolve(char* name, char** args, df_error_t** error)
ret = wmem_strdup(NULL, text->str); ret = wmem_strdup(NULL, text->str);
g_string_free(text,true); g_string_free(text,TRUE);
return ret; return ret;
} }
@ -154,7 +154,7 @@ static char* dfilter_macro_apply_recurse(const char* text, unsigned depth, df_er
return NULL; return NULL;
} }
#define FGS(n) if (n) g_string_free(n,true); n = NULL #define FGS(n) if (n) g_string_free(n,TRUE); n = NULL
#define FREE_ALL() \ #define FREE_ALL() \
do { \ do { \
@ -309,7 +309,7 @@ static char* dfilter_macro_apply_recurse(const char* text, unsigned depth, df_er
*error = df_error_new_msg("null argument in macro expression"); *error = df_error_new_msg("null argument in macro expression");
goto on_error; goto on_error;
} }
g_ptr_array_add(args,g_string_free(arg,false)); g_ptr_array_add(args,g_string_free(arg,FALSE));
arg = g_string_sized_new(32); arg = g_string_sized_new(32);
break; break;
@ -340,7 +340,7 @@ static char* dfilter_macro_apply_recurse(const char* text, unsigned depth, df_er
goto on_error; goto on_error;
} }
} else { } else {
g_ptr_array_add(args,g_string_free(arg,false)); g_ptr_array_add(args,g_string_free(arg,FALSE));
g_ptr_array_add(args,NULL); g_ptr_array_add(args,NULL);
arg = NULL; arg = NULL;
} }
@ -377,11 +377,11 @@ finish:
if (changed) { if (changed) {
resolved = dfilter_macro_apply_recurse(out->str, depth + 1, error); resolved = dfilter_macro_apply_recurse(out->str, depth + 1, error);
g_string_free(out,true); g_string_free(out,TRUE);
return resolved; return resolved;
} else { } else {
char* out_str = wmem_strdup(NULL, out->str); char* out_str = wmem_strdup(NULL, out->str);
g_string_free(out,true); g_string_free(out,TRUE);
return out_str; return out_str;
} }
} }
@ -392,7 +392,7 @@ on_error:
if (*error == NULL) if (*error == NULL)
*error = df_error_new_msg("unknown error in macro expression"); *error = df_error_new_msg("unknown error in macro expression");
} }
g_string_free(out,true); g_string_free(out,TRUE);
return NULL; return NULL;
} }
} }

View File

@ -235,7 +235,7 @@ dfsyntax_free(dfsyntax_t *dfs)
stnode_free(dfs->lval); stnode_free(dfs->lval);
if (dfs->quoted_string) if (dfs->quoted_string)
g_string_free(dfs->quoted_string, true); g_string_free(dfs->quoted_string, TRUE);

View File

@ -359,7 +359,7 @@ append_call_function(wmem_strbuf_t *buf, const char *func, const char *func_type
sep = ", "; sep = ", ";
} }
wmem_strbuf_append(buf, gs->str); wmem_strbuf_append(buf, gs->str);
g_string_free(gs, true); g_string_free(gs, TRUE);
} }
wmem_strbuf_append_printf(buf, ")%s", func_type); wmem_strbuf_append_printf(buf, ")%s", func_type);
} }

View File

@ -389,7 +389,7 @@ drange_tostr(const drange_t *dr)
} }
} }
return g_string_free(repr, false); return g_string_free(repr, FALSE);
} }
/* /*

View File

@ -284,7 +284,7 @@ HexExponent ([pP][+-]?[[:digit:]]+)
<DQUOTE><<EOF>> { <DQUOTE><<EOF>> {
/* unterminated string */ /* unterminated string */
update_string_loc(yyextra, yytext); update_string_loc(yyextra, yytext);
g_string_free(yyextra->quoted_string, true); g_string_free(yyextra->quoted_string, TRUE);
yyextra->quoted_string = NULL; yyextra->quoted_string = NULL;
FAIL("The final quote was missing from a quoted string."); FAIL("The final quote was missing from a quoted string.");
return SCAN_FAILED; return SCAN_FAILED;
@ -310,7 +310,7 @@ HexExponent ([pP][+-]?[[:digit:]]+)
unsigned long result; unsigned long result;
result = strtoul(yytext + 1, NULL, 8); result = strtoul(yytext + 1, NULL, 8);
if (result > 0xff) { if (result > 0xff) {
g_string_free(yyextra->quoted_string, true); g_string_free(yyextra->quoted_string, TRUE);
yyextra->quoted_string = NULL; yyextra->quoted_string = NULL;
FAIL("%s is larger than 255.", yytext); FAIL("%s is larger than 255.", yytext);
return SCAN_FAILED; return SCAN_FAILED;
@ -343,7 +343,7 @@ HexExponent ([pP][+-]?[[:digit:]]+)
g_string_append(yyextra->quoted_string, yytext); g_string_append(yyextra->quoted_string, yytext);
} }
else if (!append_universal_character_name(yyextra, yyextra->quoted_string, yytext)) { else if (!append_universal_character_name(yyextra, yyextra->quoted_string, yytext)) {
g_string_free(yyextra->quoted_string, true); g_string_free(yyextra->quoted_string, TRUE);
yyextra->quoted_string = NULL; yyextra->quoted_string = NULL;
return SCAN_FAILED; return SCAN_FAILED;
} }
@ -356,7 +356,7 @@ HexExponent ([pP][+-]?[[:digit:]]+)
g_string_append(yyextra->quoted_string, yytext); g_string_append(yyextra->quoted_string, yytext);
} }
else if (!append_universal_character_name(yyextra, yyextra->quoted_string, yytext)) { else if (!append_universal_character_name(yyextra, yyextra->quoted_string, yytext)) {
g_string_free(yyextra->quoted_string, true); g_string_free(yyextra->quoted_string, TRUE);
yyextra->quoted_string = NULL; yyextra->quoted_string = NULL;
return SCAN_FAILED; return SCAN_FAILED;
} }
@ -370,7 +370,7 @@ HexExponent ([pP][+-]?[[:digit:]]+)
g_string_append(yyextra->quoted_string, yytext); g_string_append(yyextra->quoted_string, yytext);
} }
else if (!append_escaped_char(yyextra, yyextra->quoted_string, yytext[1])) { else if (!append_escaped_char(yyextra, yyextra->quoted_string, yytext[1])) {
g_string_free(yyextra->quoted_string, true); g_string_free(yyextra->quoted_string, TRUE);
yyextra->quoted_string = NULL; yyextra->quoted_string = NULL;
return SCAN_FAILED; return SCAN_FAILED;
} }
@ -395,7 +395,7 @@ HexExponent ([pP][+-]?[[:digit:]]+)
<SQUOTE><<EOF>> { <SQUOTE><<EOF>> {
/* unterminated character value */ /* unterminated character value */
update_string_loc(yyextra, yytext); update_string_loc(yyextra, yytext);
g_string_free(yyextra->quoted_string, true); g_string_free(yyextra->quoted_string, TRUE);
yyextra->quoted_string = NULL; yyextra->quoted_string = NULL;
FAIL("The final quote was missing from a character constant."); FAIL("The final quote was missing from a character constant.");
return SCAN_FAILED; return SCAN_FAILED;
@ -655,7 +655,7 @@ set_lval_charconst(dfsyntax_t *dfs, GString *quoted_string)
unsigned long number; unsigned long number;
bool ok; bool ok;
char *token_value = g_string_free(quoted_string, false); char *token_value = g_string_free(quoted_string, FALSE);
ok = parse_charconst(dfs, token_value, &number); ok = parse_charconst(dfs, token_value, &number);
if (!ok) { if (!ok) {
g_free(token_value); g_free(token_value);

View File

@ -76,7 +76,7 @@ function_tostr(const void *data, bool pretty)
g_string_printf(repr, "%s#%u", def->name, g_slist_length(params)); g_string_printf(repr, "%s#%u", def->name, g_slist_length(params));
} }
return g_string_free(repr, false); return g_string_free(repr, FALSE);
} }
static void static void

View File

@ -67,7 +67,7 @@ sttype_set_tostr(const void *data, bool pretty)
} }
} }
return g_string_free(repr, false); return g_string_free(repr, FALSE);
} }
void void

View File

@ -38,7 +38,7 @@ gstring_dup(const void *value)
static void static void
gstring_free(void *value) gstring_free(void *value)
{ {
g_string_free(value, true); g_string_free(value, TRUE);
} }
static char * static char *

View File

@ -103,10 +103,10 @@ static GString *eo_rename(GString *gstr, size_t maxlen, int dupn)
} }
if (ext_str) { if (ext_str) {
g_string_free(ext_str, true); g_string_free(ext_str, TRUE);
} }
g_string_free(gstr_tmp, true); g_string_free(gstr_tmp, TRUE);
return gstr; return gstr;
} }

View File

@ -140,7 +140,7 @@ char* follow_get_stat_tap_string(register_follow_t* follower)
{ {
GString *cmd_str = g_string_new("follow,"); GString *cmd_str = g_string_new("follow,");
g_string_append(cmd_str, proto_get_protocol_filter_name(follower->proto_id)); g_string_append(cmd_str, proto_get_protocol_filter_name(follower->proto_id));
return g_string_free(cmd_str, false); return g_string_free(cmd_str, FALSE);
} }
/* here we are going to try and reconstruct the data portion of a TCP /* here we are going to try and reconstruct the data portion of a TCP

View File

@ -356,10 +356,10 @@ read_mmdbr_stdout_worker(void *data _U_) {
} }
} }
g_string_free(country_iso, true); g_string_free(country_iso, TRUE);
g_string_free(country, true); g_string_free(country, TRUE);
g_string_free(city, true); g_string_free(city, TRUE);
g_string_free(as_org, true); g_string_free(as_org, TRUE);
g_free(line_buf); g_free(line_buf);
g_free(response); g_free(response);
return NULL; return NULL;
@ -810,7 +810,7 @@ maxmind_db_get_paths(void) {
g_string_truncate(path_str, path_str->len-1); g_string_truncate(path_str, path_str->len-1);
return g_string_free(path_str, false); return g_string_free(path_str, FALSE);
} }
void void

View File

@ -596,7 +596,7 @@ static void register_mibs(void) {
} }
g_free(path_str); g_free(path_str);
g_string_free(smi_errors,true); g_string_free(smi_errors,TRUE);
for (smiModule = smiGetFirstModule(); for (smiModule = smiGetFirstModule();
smiModule; smiModule;
@ -1286,7 +1286,7 @@ oid_get_default_mib_path(void) {
if (!load_smi_modules) { if (!load_smi_modules) {
D(1,("OID resolution not enabled")); D(1,("OID resolution not enabled"));
return g_string_free(path_str, false); return g_string_free(path_str, FALSE);
} }
#ifdef _WIN32 #ifdef _WIN32
path = get_datafile_path("snmp\\mibs"); path = get_datafile_path("snmp\\mibs");
@ -1319,7 +1319,7 @@ oid_get_default_mib_path(void) {
#ifndef _WIN32 #ifndef _WIN32
} }
#endif #endif
return g_string_free(path_str, false); return g_string_free(path_str, FALSE);
#else /* HAVE_LIBSMI */ #else /* HAVE_LIBSMI */
return g_strdup(""); return g_strdup("");
#endif #endif

View File

@ -2612,7 +2612,7 @@ column_hidden_to_str_cb(pref_t* pref, bool default_val)
cidx++; cidx++;
} }
return g_string_free (cols_hidden, false); return g_string_free (cols_hidden, FALSE);
} }
static bool static bool
@ -2698,7 +2698,7 @@ column_hidden_fmt_to_str_cb(pref_t* pref, bool default_val)
clp = clp->next; clp = clp->next;
} }
return g_string_free (cols_hidden, false); return g_string_free (cols_hidden, FALSE);
} }
static bool static bool
@ -4067,14 +4067,14 @@ prefs_get_string_list(const char *str)
if (state == IN_QUOT || backslash) { if (state == IN_QUOT || backslash) {
/* We were in the middle of a quoted string or backslash escape, /* We were in the middle of a quoted string or backslash escape,
and ran out of characters; that's an error. */ and ran out of characters; that's an error. */
g_string_free(slstr, true); g_string_free(slstr, TRUE);
prefs_clear_string_list(sl); prefs_clear_string_list(sl);
return NULL; return NULL;
} }
if (slstr->len > 0) if (slstr->len > 0)
sl = g_list_append(sl, g_string_free(slstr, false)); sl = g_list_append(sl, g_string_free(slstr, FALSE));
else else
g_string_free(slstr, true); g_string_free(slstr, TRUE);
break; break;
} }
if (cur_c == '"' && !backslash) { if (cur_c == '"' && !backslash) {
@ -4110,7 +4110,7 @@ prefs_get_string_list(const char *str)
and it wasn't preceded by a backslash; it's the end of and it wasn't preceded by a backslash; it's the end of
the string we were working on... */ the string we were working on... */
if (slstr->len > 0) { if (slstr->len > 0) {
sl = g_list_append(sl, g_string_free(slstr, false)); sl = g_list_append(sl, g_string_free(slstr, FALSE));
slstr = g_string_sized_new(default_size); slstr = g_string_sized_new(default_size);
} }
@ -4170,7 +4170,7 @@ char *join_string_list(GList *sl)
cur = cur->next; cur = cur->next;
} }
return g_string_free(joined_str, false); return g_string_free(joined_str, FALSE);
} }
void void
@ -4993,8 +4993,8 @@ read_prefs_file(const char *pf_path, FILE *pf,
} }
} }
g_string_free(cur_val, true); g_string_free(cur_val, TRUE);
g_string_free(cur_var, true); g_string_free(cur_var, TRUE);
if (ferror(pf)) if (ferror(pf))
return errno; return errno;
@ -6685,7 +6685,7 @@ prefs_pref_type_description(pref_t *pref)
g_string_append(enum_str, ", "); g_string_append(enum_str, ", ");
} }
g_string_append(enum_str, "\n(case-insensitive)."); g_string_append(enum_str, "\n(case-insensitive).");
return g_string_free(enum_str, false); return g_string_free(enum_str, FALSE);
} }
case PREF_STRING: case PREF_STRING:

View File

@ -1084,7 +1084,7 @@ proto_registrar_get_byalias(const char *alias_name)
} }
header_field_info *hfinfo = proto_registrar_get_byname(filter_name->str); header_field_info *hfinfo = proto_registrar_get_byname(filter_name->str);
g_free(an_copy); g_free(an_copy);
g_string_free(filter_name, true); g_string_free(filter_name, TRUE);
return hfinfo; return hfinfo;
} }

View File

@ -822,7 +822,7 @@ bool radius_load_dictionary (radius_dictionary_t* d, char* dir, const char* file
if (!in) { if (!in) {
g_string_append_printf(state.error, "Could not open file: '%s', error: %s\n", state.fullpaths[0], g_strerror(errno)); g_string_append_printf(state.error, "Could not open file: '%s', error: %s\n", state.fullpaths[0], g_strerror(errno));
g_free(state.fullpaths[0]); g_free(state.fullpaths[0]);
*err_str = g_string_free(state.error,false); *err_str = g_string_free(state.error,FALSE);
return false; return false;
} }
@ -833,7 +833,7 @@ bool radius_load_dictionary (radius_dictionary_t* d, char* dir, const char* file
strerror(errno)); strerror(errno));
fclose(in); fclose(in);
g_free(state.fullpaths[0]); g_free(state.fullpaths[0]);
*err_str = g_string_free(state.error,false); *err_str = g_string_free(state.error,FALSE);
return false; return false;
} }
@ -860,11 +860,11 @@ bool radius_load_dictionary (radius_dictionary_t* d, char* dir, const char* file
g_hash_table_destroy(state.value_strings); g_hash_table_destroy(state.value_strings);
if (state.error->len > 0) { if (state.error->len > 0) {
*err_str = g_string_free(state.error,false); *err_str = g_string_free(state.error,FALSE);
return false; return false;
} else { } else {
*err_str = NULL; *err_str = NULL;
g_string_free(state.error,true); g_string_free(state.error,TRUE);
return true; return true;
} }
} }

View File

@ -112,7 +112,7 @@ char* rtd_table_get_tap_string(register_rtd_t* rtd)
{ {
GString *cmd_str = g_string_new(proto_get_protocol_filter_name(rtd->proto_id)); GString *cmd_str = g_string_new(proto_get_protocol_filter_name(rtd->proto_id));
g_string_append(cmd_str, ",rtd"); g_string_append(cmd_str, ",rtd");
return g_string_free(cmd_str, false); return g_string_free(cmd_str, FALSE);
} }
void rtd_table_get_filter(register_rtd_t* rtd, const char *opt_arg, const char **filter, char** err) void rtd_table_get_filter(register_rtd_t* rtd, const char *opt_arg, const char **filter, char** err)

View File

@ -388,7 +388,7 @@ uat_pkcs11_libs_load_all(void)
} }
if (err) { if (err) {
report_failure("%s", err->str); report_failure("%s", err->str);
g_string_free(err, true); g_string_free(err, TRUE);
} }
} }
@ -519,7 +519,7 @@ uat_rsa_privkeys_post_update(void)
} }
if (errors) { if (errors) {
report_failure("%s", errors->str); report_failure("%s", errors->str);
g_string_free(errors, true); g_string_free(errors, TRUE);
} }
} }

View File

@ -627,11 +627,11 @@ sequence_analysis_dump_to_file(FILE *of, seq_analysis_info_t *sainfo, unsigned
fprintf(of, "%s\n", tmp_str->str); fprintf(of, "%s\n", tmp_str->str);
} }
g_string_free(label_string, true); g_string_free(label_string, TRUE);
g_string_free(empty_line, true); g_string_free(empty_line, TRUE);
g_string_free(separator_line, true); g_string_free(separator_line, TRUE);
g_string_free(tmp_str, true); g_string_free(tmp_str, TRUE);
g_string_free(tmp_str2, true); g_string_free(tmp_str2, TRUE);
} }
/* /*

View File

@ -130,7 +130,7 @@ char* srt_table_get_tap_string(register_srt_t* srt)
{ {
GString *cmd_str = g_string_new(proto_get_protocol_filter_name(srt->proto_id)); GString *cmd_str = g_string_new(proto_get_protocol_filter_name(srt->proto_id));
g_string_append(cmd_str, ",srt"); g_string_append(cmd_str, ",srt");
return g_string_free(cmd_str, false); return g_string_free(cmd_str, FALSE);
} }
void srt_table_get_filter(register_srt_t* srt, const char *opt_arg, const char **filter, char** err) void srt_table_get_filter(register_srt_t* srt, const char *opt_arg, const char **filter, char** err)

View File

@ -297,7 +297,7 @@ stats_tree_register(const char *tapname, const char *abbr, const char *path,
sep = " / "; sep = " / ";
} }
g_strfreev(split); g_strfreev(split);
cfg->title = g_string_free(title_str, false); cfg->title = g_string_free(title_str, FALSE);
cfg->packet = packet; cfg->packet = packet;
cfg->init = init; cfg->init = init;

View File

@ -609,7 +609,7 @@ xml_escape(const char *unescaped)
/* Return the string value contained within the GString /* Return the string value contained within the GString
* after getting rid of the GString structure. * after getting rid of the GString structure.
* This is the way to do this, see the GLib reference. */ * This is the way to do this, see the GLib reference. */
return g_string_free(buffer, false); return g_string_free(buffer, FALSE);
} }
/* /*

View File

@ -311,7 +311,7 @@ char *uat_fld_tostr(void *rec, uat_field_t *f) {
for (i=0; i<len;i++) g_string_append_printf(s, "%.2X", ((const uint8_t*)ptr)[i]); for (i=0; i<len;i++) g_string_append_printf(s, "%.2X", ((const uint8_t*)ptr)[i]);
out = g_string_free(s, false); out = g_string_free(s, FALSE);
break; break;
} }
default: default:

View File

@ -1287,7 +1287,7 @@ static int wslua_console_print(lua_State *_L)
else { else {
wslua_gui_print_func_ptr(gstr->str, wslua_gui_print_data_ptr); wslua_gui_print_func_ptr(gstr->str, wslua_gui_print_data_ptr);
} }
g_string_free(gstr, true); g_string_free(gstr, TRUE);
return 0; return 0;
} }

View File

@ -811,7 +811,7 @@ WSLUA_METAMETHOD DissectorTable__tostring(lua_State* L) {
} }
lua_pushstring(L,s->str); lua_pushstring(L,s->str);
g_string_free(s,true); g_string_free(s,TRUE);
WSLUA_RETURN(1); /* A string of debug information about the <<lua_class_DissectorTable,`DissectorTable`>>. */ WSLUA_RETURN(1); /* A string of debug information about the <<lua_class_DissectorTable,`DissectorTable`>>. */
} }

View File

@ -565,13 +565,13 @@ void lua_prime_all_fields(proto_tree* tree _U_) {
if (error) { if (error) {
report_failure("while registering lua_fake_tap:\n%s",error->str); report_failure("while registering lua_fake_tap:\n%s",error->str);
g_string_free(error,true); g_string_free(error,TRUE);
} else if (!dfilter_compile(fake_tap_filter->str, &wslua_dfilter, &df_err)) { } else if (!dfilter_compile(fake_tap_filter->str, &wslua_dfilter, &df_err)) {
report_failure("while compiling dfilter \"%s\" for wslua: %s", fake_tap_filter->str, df_err->msg); report_failure("while compiling dfilter \"%s\" for wslua: %s", fake_tap_filter->str, df_err->msg);
df_error_free(&df_err); df_error_free(&df_err);
} }
} }
g_string_free(fake_tap_filter, true); g_string_free(fake_tap_filter, TRUE);
} }
WSLUA_CONSTRUCTOR Field_new(lua_State *L) { WSLUA_CONSTRUCTOR Field_new(lua_State *L) {

View File

@ -1029,7 +1029,7 @@ WSLUA_FUNCTION wslua_copy_to_clipboard(lua_State* L) { /* Copy a string into the
ops->copy_to_clipboard(gstr); ops->copy_to_clipboard(gstr);
g_string_free(gstr,true); g_string_free(gstr,TRUE);
return 0; return 0;
} }

View File

@ -253,7 +253,7 @@ WSLUA_CONSTRUCTOR Listener_new(lua_State* L) {
g_free(tap); g_free(tap);
/* WSLUA_ERROR(new_tap,"tap registration error"); */ /* WSLUA_ERROR(new_tap,"tap registration error"); */
lua_pushfstring(L,"Error while registering tap:\n%s",error->str); lua_pushfstring(L,"Error while registering tap:\n%s",error->str);
g_string_free(error,true); g_string_free(error,TRUE);
return luaL_error(L,lua_tostring(L,-1)); return luaL_error(L,lua_tostring(L,-1));
} }

View File

@ -74,7 +74,7 @@ WSLUA_METAMETHOD PrivateTable__tostring(lua_State* L) {
lua_pushstring(L,key_string->str); lua_pushstring(L,key_string->str);
g_string_free (key_string, true); g_string_free (key_string, TRUE);
g_list_free (keys); g_list_free (keys);
WSLUA_RETURN(1); /* A string with all keys in the table, mostly for debugging. */ WSLUA_RETURN(1); /* A string with all keys in the table, mostly for debugging. */

View File

@ -162,7 +162,7 @@ static char* interfaces_list_to_filter(GSList* interfaces, unsigned int remote_p
g_string_append_printf(filter, ", permit ip any any"); g_string_append_printf(filter, ", permit ip any any");
} }
return g_string_free(filter, false); return g_string_free(filter, FALSE);
} }
static char* local_interfaces_to_filter(const unsigned int remote_port) static char* local_interfaces_to_filter(const unsigned int remote_port)

View File

@ -408,7 +408,7 @@ void extcap_cmdline_debug(char** ar, const unsigned n)
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
g_string_append_printf(cmdline, "%s ", ar[i]); g_string_append_printf(cmdline, "%s ", ar[i]);
ws_debug("%s", cmdline->str); ws_debug("%s", cmdline->str);
g_string_free(cmdline, true); g_string_free(cmdline, TRUE);
} }
/* /*

View File

@ -125,7 +125,7 @@ struct plugin_configuration {
json_dumper_finish(&dumper); json_dumper_finish(&dumper);
std::string config_blob = dumper.output_string->str; std::string config_blob = dumper.output_string->str;
ws_debug("configuration: %s", dumper.output_string->str); ws_debug("configuration: %s", dumper.output_string->str);
g_string_free(dumper.output_string, true); g_string_free(dumper.output_string, TRUE);
return config_blob; return config_blob;
} }
}; };

View File

@ -196,7 +196,7 @@ static ssh_channel run_ssh_command(ssh_session sshs, const char* capture_command
g_string_append_printf(ifaces_string, "-i %s ", quoted_iface); g_string_append_printf(ifaces_string, "-i %s ", quoted_iface);
ifaces_array_num++; ifaces_array_num++;
} }
ifaces = g_string_free(ifaces_string, false); ifaces = g_string_free(ifaces_string, FALSE);
} }
quoted_filter = g_shell_quote(cfilter ? cfilter : ""); quoted_filter = g_shell_quote(cfilter ? cfilter : "");
if (count > 0) if (count > 0)
@ -306,7 +306,7 @@ static char* interfaces_list_to_filter(GSList* interfaces, unsigned int remote_p
} }
g_string_append_printf(filter, ") and port %u)", remote_port); g_string_append_printf(filter, ") and port %u)", remote_port);
} }
return g_string_free(filter, false); return g_string_free(filter, FALSE);
} }
static int list_config(char *interface, unsigned int remote_port) static int list_config(char *interface, unsigned int remote_port)

View File

@ -349,7 +349,7 @@ fileset_add_dir(const char *fname, void *window)
/* don't add the file to the dialog here, this will be done in fileset_update_dlg() below */ /* don't add the file to the dialog here, this will be done in fileset_update_dlg() below */
} }
g_string_free(dirname, true /* free_segment */); g_string_free(dirname, TRUE /* free_segment */);
/* sort entries by creation time */ /* sort entries by creation time */
set.entries = g_list_sort(set.entries, fileset_sort_compare); set.entries = g_list_sort(set.entries, fileset_sort_compare);

View File

@ -165,7 +165,7 @@ static char* recolonize(mate_config* mc, char* s) {
r = str->str; r = str->str;
g_string_free(str,false); g_string_free(str,FALSE);
return r; return r;
} }

View File

@ -752,7 +752,7 @@ char* avpl_to_str(AVPL* avpl) {
g_free(avp_s); g_free(avp_s);
} }
r = g_string_free(s,false); r = g_string_free(s,FALSE);
/* g_strchug(r); ? */ /* g_strchug(r); ? */
return r; return r;
@ -770,7 +770,7 @@ extern char* avpl_to_dotstr(AVPL* avpl) {
g_free(avp_s); g_free(avp_s);
} }
r = g_string_free(s,false); r = g_string_free(s,FALSE);
/* g_strchug(r); ? */ /* g_strchug(r); ? */
return r; return r;

View File

@ -766,12 +766,12 @@ wimaxasncp_dict_t *wimaxasncp_dict_scan(
if (state.dict_error->len > 0) if (state.dict_error->len > 0)
{ {
*error = g_string_free(state.dict_error, false); *error = g_string_free(state.dict_error, FALSE);
} }
else else
{ {
*error = NULL; *error = NULL;
g_string_free(state.dict_error, true); g_string_free(state.dict_error, TRUE);
} }
return state.dict; return state.dict;
} }

View File

@ -132,7 +132,7 @@ capture_start(capture_options *capture_opts, GPtrArray *capture_comments,
ws_message("Capture Start ..."); ws_message("Capture Start ...");
source = get_iface_list_string(capture_opts, IFLIST_SHOW_FILTER); source = get_iface_list_string(capture_opts, IFLIST_SHOW_FILTER);
cf_set_tempfile_source((capture_file *)cap_session->cf, source->str); cf_set_tempfile_source((capture_file *)cap_session->cf, source->str);
g_string_free(source, true); g_string_free(source, TRUE);
/* try to start the capture child process */ /* try to start the capture child process */
if (!sync_pipe_start(capture_opts, capture_comments, cap_session, if (!sync_pipe_start(capture_opts, capture_comments, cap_session,
cap_data, update_cb)) { cap_data, update_cb)) {
@ -738,7 +738,7 @@ capture_input_closed(capture_session *cap_session, char *msg)
} }
ws_warning("%s", msg); ws_warning("%s", msg);
simple_dialog(dlg_type, ESD_BTN_OK, "%s", gui_msg->str); simple_dialog(dlg_type, ESD_BTN_OK, "%s", gui_msg->str);
g_string_free(gui_msg, true); g_string_free(gui_msg, TRUE);
g_strfreev(msg_lines); g_strfreev(msg_lines);
} }

View File

@ -225,7 +225,7 @@ static void camelsrt_init(const char *opt_arg, void *userdata _U_)
g_free(p_camelsrt); g_free(p_camelsrt);
cmdarg_err("Couldn't register camel,srt tap: %s", error_string->str); cmdarg_err("Couldn't register camel,srt tap: %s", error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
exit(1); exit(1);
} }

View File

@ -81,7 +81,7 @@ static void credentials_init(const char *opt_arg _U_, void *userdata _U_)
if (error_string) { if (error_string) {
/* error, we failed to attach to the tap. clean up */ /* error, we failed to attach to the tap. clean up */
cmdarg_err("Couldn't register credentials tap: %s", error_string->str); cmdarg_err("Couldn't register credentials tap: %s", error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
exit(1); exit(1);
} }

View File

@ -254,7 +254,7 @@ diameteravp_init(const char *opt_arg, void *userdata _U_)
g_string_append(filter, field); g_string_append(filter, field);
} }
g_strfreev(tokens); g_strfreev(tokens);
ds->filter = g_string_free(filter, false); ds->filter = g_string_free(filter, FALSE);
error_string = register_tap_listener("diameter", ds, ds->filter, 0, NULL, diameteravp_packet, diameteravp_draw, NULL); error_string = register_tap_listener("diameter", ds, ds->filter, 0, NULL, diameteravp_packet, diameteravp_draw, NULL);
if (error_string) { if (error_string) {
@ -263,7 +263,7 @@ diameteravp_init(const char *opt_arg, void *userdata _U_)
cmdarg_err("Couldn't register diam,csv tap: %s", cmdarg_err("Couldn't register diam,csv tap: %s",
error_string->str); error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
exit(1); exit(1);
} }
} }

View File

@ -114,7 +114,7 @@ void init_endpoints(struct register_ct *ct, const char *filter)
g_free(iu); g_free(iu);
cmdarg_err("Couldn't register endpoint tap: %s", cmdarg_err("Couldn't register endpoint tap: %s",
error_string->str); error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
exit(1); exit(1);
} }

View File

@ -264,7 +264,7 @@ static void expert_stat_init(const char *opt_arg, void *userdata _U_)
(tap_finish_cb)expert_tapdata_free); (tap_finish_cb)expert_tapdata_free);
if (error_string) { if (error_string) {
printf("Expert tap error (%s)!\n", error_string->str); printf("Expert tap error (%s)!\n", error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
expert_tapdata_free(hs); expert_tapdata_free(hs);
exit(1); exit(1);
} }

View File

@ -136,7 +136,7 @@ eo_draw(void *tapdata)
EXPORT_OBJECT_MAXFILELEN, count); EXPORT_OBJECT_MAXFILELEN, count);
} }
save_as_fullpath = g_build_filename(save_in_path, safe_filename->str, NULL); save_as_fullpath = g_build_filename(save_in_path, safe_filename->str, NULL);
g_string_free(safe_filename, true); g_string_free(safe_filename, TRUE);
} while (g_file_test(save_as_fullpath, G_FILE_TEST_EXISTS) && ++count < prefs.gui_max_export_objects); } while (g_file_test(save_as_fullpath, G_FILE_TEST_EXISTS) && ++count < prefs.gui_max_export_objects);
count = 0; count = 0;
write_file_binary_mode(save_as_fullpath, entry->payload_data, entry->payload_len); write_file_binary_mode(save_as_fullpath, entry->payload_data, entry->payload_len);
@ -176,7 +176,7 @@ exportobject_handler(void *key, void *value _U_, void *user_data _U_)
if (error_msg) { if (error_msg) {
cmdarg_err("Can't register %s tap: %s", (const char*)key, error_msg->str); cmdarg_err("Can't register %s tap: %s", (const char*)key, error_msg->str);
g_string_free(error_msg, true); g_string_free(error_msg, TRUE);
g_free(tap_data); g_free(tap_data);
g_free(object_list); g_free(object_list);
return; return;

View File

@ -100,7 +100,7 @@ flow_init(const char *opt_argp, void *userdata)
{ {
sequence_analysis_list_free(flow_info); sequence_analysis_list_free(flow_info);
sequence_analysis_info_free(flow_info); sequence_analysis_info_free(flow_info);
g_string_free(errp, true); g_string_free(errp, TRUE);
flow_exit("Error registering tap listener."); flow_exit("Error registering tap listener.");
} }
} }
@ -114,7 +114,7 @@ flow_register(const void *key _U_, void *value, void *userdata _U_)
char *cli_string; char *cli_string;
g_string_append(cmd_str, sequence_analysis_get_name(analysis)); g_string_append(cmd_str, sequence_analysis_get_name(analysis));
cli_string = g_string_free(cmd_str, false); cli_string = g_string_free(cmd_str, FALSE);
flow_ui.group = REGISTER_STAT_GROUP_GENERIC; flow_ui.group = REGISTER_STAT_GROUP_GENERIC;
flow_ui.title = NULL; /* construct this from the protocol info? */ flow_ui.title = NULL; /* construct this from the protocol info? */

View File

@ -595,7 +595,7 @@ static void follow_stream(const char *opt_argp, void *userdata)
if (errp != NULL) if (errp != NULL)
{ {
follow_free(follow_info); follow_free(follow_info);
g_string_free(errp, true); g_string_free(errp, TRUE);
follow_exit("Error registering tap listener."); follow_exit("Error registering tap listener.");
} }
} }

View File

@ -45,7 +45,7 @@ static funnel_text_window_t *new_text_window(funnel_ops_id_t *ops_id _U_, const
} }
static void text_window_clear(funnel_text_window_t *tw) { static void text_window_clear(funnel_text_window_t *tw) {
g_string_free(tw->text, true); g_string_free(tw->text, TRUE);
tw->text = g_string_new(""); tw->text = g_string_new("");
} }
@ -54,7 +54,7 @@ static void text_window_append(funnel_text_window_t *tw, const char *text ) {
} }
static void text_window_set_text(funnel_text_window_t *tw, const char *text) { static void text_window_set_text(funnel_text_window_t *tw, const char *text) {
g_string_free(tw->text, true); g_string_free(tw->text, TRUE);
tw->text = g_string_new(text); tw->text = g_string_new(text);
} }
@ -118,7 +118,7 @@ void funnel_dump_all_text_windows(void) {
g_ptr_array_remove_index(text_windows, i); g_ptr_array_remove_index(text_windows, i);
g_free(tw->title); g_free(tw->title);
g_string_free(tw->text, true); g_string_free(tw->text, TRUE);
g_free(tw); g_free(tw);
} }
} }

View File

@ -324,7 +324,7 @@ gsm_a_stat_init(const char *opt_arg _U_, void *userdata _U_)
if (err_p != NULL) if (err_p != NULL)
{ {
g_free(stat_p); g_free(stat_p);
g_string_free(err_p, true); g_string_free(err_p, TRUE);
exit(1); exit(1);
} }

View File

@ -122,7 +122,7 @@ hosts_init(const char *opt_arg, void *userdata _U_)
/* error, we failed to attach to the tap. clean up */ /* error, we failed to attach to the tap. clean up */
cmdarg_err("Couldn't register " TAP_NAME " tap: %s", cmdarg_err("Couldn't register " TAP_NAME " tap: %s",
error_string->str); error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
exit(1); exit(1);
} }
} }

View File

@ -261,7 +261,7 @@ httpstat_init(const char *opt_arg, void *userdata _U_)
g_free(sp); g_free(sp);
cmdarg_err("Couldn't register http,stat tap: %s", cmdarg_err("Couldn't register http,stat tap: %s",
error_string->str); error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
exit(1); exit(1);
} }

View File

@ -294,7 +294,7 @@ icmpstat_init(const char *opt_arg, void *userdata _U_)
g_free(icmpstat); g_free(icmpstat);
cmdarg_err("Couldn't register icmp,srt tap: %s", error_string->str); cmdarg_err("Couldn't register icmp,srt tap: %s", error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
exit(1); exit(1);
} }
} }

View File

@ -294,7 +294,7 @@ icmpv6stat_init(const char *opt_arg, void *userdata _U_)
g_free(icmpv6stat); g_free(icmpv6stat);
cmdarg_err("Couldn't register icmpv6,srt tap: %s", error_string->str); cmdarg_err("Couldn't register icmpv6,srt tap: %s", error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
exit(1); exit(1);
} }
} }

View File

@ -1381,7 +1381,7 @@ register_io_tap(io_stat_t *io, unsigned int i, const char *filter)
g_free(io); g_free(io);
fprintf(stderr, "\ntshark: Couldn't register io,stat tap: %s\n", fprintf(stderr, "\ntshark: Couldn't register io,stat tap: %s\n",
error_string->str); error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
exit(1); exit(1);
} }
} }

View File

@ -247,7 +247,7 @@ void init_iousers(struct register_ct *ct, const char *filter)
g_free(iu); g_free(iu);
cmdarg_err("Couldn't register conversations tap: %s", cmdarg_err("Couldn't register conversations tap: %s",
error_string->str); error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
exit(1); exit(1);
} }

View File

@ -511,7 +511,7 @@ static void mac_lte_stat_init(const char *opt_arg, void *userdata _U_)
mac_lte_stat_draw, mac_lte_stat_draw,
NULL); NULL);
if (error_string) { if (error_string) {
g_string_free(error_string, true); g_string_free(error_string, TRUE);
g_free(hs); g_free(hs);
exit(1); exit(1);
} }

View File

@ -113,7 +113,7 @@ protocolinfo_init(const char *opt_arg, void *userdata _U_)
/* error, we failed to attach to the tap. complain and clean up */ /* error, we failed to attach to the tap. complain and clean up */
cmdarg_err("Couldn't register proto,colinfo tap: %s", cmdarg_err("Couldn't register proto,colinfo tap: %s",
error_string->str); error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
g_free(rs->filter); g_free(rs->filter);
g_free(rs); g_free(rs);

View File

@ -210,7 +210,7 @@ protohierstat_init(const char *opt_arg, void *userdata _U_)
cmdarg_err("Couldn't register io,phs tap: %s", cmdarg_err("Couldn't register io,phs tap: %s",
error_string->str); error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
exit(1); exit(1);
} }
} }

View File

@ -391,7 +391,7 @@ static void rlc_lte_stat_init(const char *opt_arg, void *userdata _U_)
rlc_lte_stat_draw, rlc_lte_stat_draw,
NULL); NULL);
if (error_string) { if (error_string) {
g_string_free(error_string, true); g_string_free(error_string, TRUE);
g_free(hs); g_free(hs);
exit(1); exit(1);
} }

View File

@ -212,7 +212,7 @@ rpcprogs_init(const char *opt_arg _U_, void *userdata _U_)
if (error_string) { if (error_string) {
cmdarg_err("Couldn't register rpc,programs tap: %s", cmdarg_err("Couldn't register rpc,programs tap: %s",
error_string->str); error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
exit(1); exit(1);
} }
} }

View File

@ -106,7 +106,7 @@ init_rtd_tables(register_rtd_t* rtd, const char *filter)
if (error_string) { if (error_string) {
free_rtd_table(&ui->rtd.stat_table); free_rtd_table(&ui->rtd.stat_table);
cmdarg_err("Couldn't register srt tap: %s", error_string->str); cmdarg_err("Couldn't register srt tap: %s", error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
exit(1); exit(1);
} }
} }

View File

@ -253,7 +253,7 @@ rtspstat_init(const char *opt_arg, void *userdata _U_)
g_free(sp); g_free(sp);
cmdarg_err("Couldn't register rtsp,stat tap: %s", cmdarg_err("Couldn't register rtsp,stat tap: %s",
error_string->str); error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
exit(1); exit(1);
} }

View File

@ -209,7 +209,7 @@ sctpstat_init(const char *opt_arg, void *userdata _U_)
cmdarg_err("Couldn't register sctp,stat tap: %s", cmdarg_err("Couldn't register sctp,stat tap: %s",
error_string->str); error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
exit(1); exit(1);
} }
} }

View File

@ -115,7 +115,7 @@ init_stat_table(stat_tap_table_ui *stat_tap, const char *filter)
if (error_string) { if (error_string) {
/* free_rtd_table(&ui->rtd.stat_table); */ /* free_rtd_table(&ui->rtd.stat_table); */
cmdarg_err("Couldn't register tap: %s", error_string->str); cmdarg_err("Couldn't register tap: %s", error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
exit(1); exit(1);
} }
} }

View File

@ -332,7 +332,7 @@ sipstat_init(const char *opt_arg, void *userdata _U_)
g_free(sp); g_free(sp);
cmdarg_err("Couldn't register sip,stat tap: %s", cmdarg_err("Couldn't register sip,stat tap: %s",
error_string->str); error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
exit(1); exit(1);
} }

View File

@ -72,7 +72,7 @@ smbsids_init(const char *opt_arg _U_, void *userdata _U_)
if (error_string) { if (error_string) {
cmdarg_err("Couldn't register smb,sids tap: %s", cmdarg_err("Couldn't register smb,sids tap: %s",
error_string->str); error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
exit(1); exit(1);
} }
} }

View File

@ -127,7 +127,7 @@ init_srt_tables(register_srt_t* srt, const char *filter)
free_srt_table(srt, global_srt_array); free_srt_table(srt, global_srt_array);
g_free(ui); g_free(ui);
cmdarg_err("Couldn't register srt tap: %s", error_string->str); cmdarg_err("Couldn't register srt tap: %s", error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
exit(1); exit(1);
} }
} }

View File

@ -45,7 +45,7 @@ draw_stats_tree(void *psp)
stats_tree_is_default_sort_DESC(st)); stats_tree_is_default_sort_DESC(st));
printf("%s", s->str); printf("%s", s->str);
g_string_free(s, true); g_string_free(s, TRUE);
} }
static void static void

View File

@ -61,7 +61,7 @@ svstat_init(const char *opt_arg _U_, void *userdata _U_)
/* error, we failed to attach to the tap. clean up */ /* error, we failed to attach to the tap. clean up */
cmdarg_err("Couldn't register sv,stat tap: %s", cmdarg_err("Couldn't register sv,stat tap: %s",
error_string->str); error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
exit(1); exit(1);
} }
} }

View File

@ -259,7 +259,7 @@ wspstat_init(const char *opt_arg, void *userdata _U_)
g_free(sp); g_free(sp);
cmdarg_err("Couldn't register wsp,stat tap: %s", cmdarg_err("Couldn't register wsp,stat tap: %s",
error_string->str); error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
exit(1); exit(1);
} }
} }

View File

@ -42,7 +42,7 @@ user_guide_url(const char *page) {
if (g_file_test(ug_dir->str, G_FILE_TEST_IS_DIR)) { if (g_file_test(ug_dir->str, G_FILE_TEST_IS_DIR)) {
g_string_printf(url, "file:///%s/%s", ug_dir->str, page); g_string_printf(url, "file:///%s/%s", ug_dir->str, page);
} }
g_string_free(ug_dir, true); g_string_free(ug_dir, TRUE);
#else #else
char *path = g_build_filename(get_doc_dir(), "wsug_html_chunked", page, NULL); char *path = g_build_filename(get_doc_dir(), "wsug_html_chunked", page, NULL);
if (g_file_test(path, G_FILE_TEST_IS_REGULAR)) { if (g_file_test(path, G_FILE_TEST_IS_REGULAR)) {
@ -58,7 +58,7 @@ user_guide_url(const char *page) {
if (url->len == 0) { if (url->len == 0) {
g_string_printf(url, WS_DOCS_URL "wsug_html_chunked/%s", page); g_string_printf(url, WS_DOCS_URL "wsug_html_chunked/%s", page);
} }
return g_string_free(url, false); return g_string_free(url, FALSE);
} }
char * char *

View File

@ -387,7 +387,7 @@ scan_local_interfaces_filtered(GList * allowed_types, void (*update_cb)(void))
} }
} }
device.addresses = g_strdup(ip_str->str); device.addresses = g_strdup(ip_str->str);
g_string_free(ip_str, true); g_string_free(ip_str, TRUE);
device.links = NULL; device.links = NULL;
caps = if_info->caps; caps = if_info->caps;

View File

@ -920,7 +920,7 @@ void LograyMainWindow::pushLiveCaptureInProgress() {
if (capture_opts->save_file) if (capture_opts->save_file)
msgtip += capture_opts->save_file; msgtip += capture_opts->save_file;
mainApp->pushStatus(WiresharkApplication::FileStatus, msg, msgtip); mainApp->pushStatus(WiresharkApplication::FileStatus, msg, msgtip);
g_string_free(interface_names, true); g_string_free(interface_names, TRUE);
#endif // HAVE_LIBPCAP #endif // HAVE_LIBPCAP
} }

View File

@ -95,7 +95,7 @@ bluetooth_devices_tap(void *data)
if (error_string != NULL) { if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"%s", error_string->str); "%s", error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
} }
} }

View File

@ -80,7 +80,7 @@ bluetooth_hci_summary_tap_init(void *data)
if (error_string != NULL) { if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"%s", error_string->str); "%s", error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
} }
} }
@ -916,7 +916,7 @@ void BluetoothHciSummaryDialog::displayFilterLineEditAccepted()
if (error_string != NULL) { if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"%s", error_string->str); "%s", error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
} }
cap_file_.retapPackets(); cap_file_.retapPackets();

View File

@ -95,7 +95,7 @@ void CompiledFilterOutput::compileFilter()
} }
g_mutex_unlock(&pcap_compile_mtx_); g_mutex_unlock(&pcap_compile_mtx_);
compile_results.insert(current.interface, QString(bpf_code_dump->str)); compile_results.insert(current.interface, QString(bpf_code_dump->str));
g_string_free(bpf_code_dump, true); g_string_free(bpf_code_dump, TRUE);
ui->interfaceList->addItem(new QListWidgetItem(current.interface)); ui->interfaceList->addItem(new QListWidgetItem(current.interface));
pcap_freecode(&fcode); pcap_freecode(&fcode);
} }

View File

@ -264,7 +264,7 @@ void ExportObjectDialog::saveCurrentEntry(QString *tempFile)
GString *safe_filename = eo_massage_str(entry_filename.toUtf8().constData(), EXPORT_OBJECT_MAXFILELEN, 0); GString *safe_filename = eo_massage_str(entry_filename.toUtf8().constData(), EXPORT_OBJECT_MAXFILELEN, 0);
file_name = WiresharkFileDialog::getSaveFileName(this, mainApp->windowTitleString(tr("Save Object As…")), file_name = WiresharkFileDialog::getSaveFileName(this, mainApp->windowTitleString(tr("Save Object As…")),
safe_filename->str); safe_filename->str);
g_string_free(safe_filename, true); g_string_free(safe_filename, TRUE);
} else { } else {
QString path = QDir::tempPath().append("/").append(entry_filename); QString path = QDir::tempPath().append("/").append(entry_filename);
/* This means, the system must remove the file! */ /* This means, the system must remove the file! */

View File

@ -145,7 +145,7 @@ void FirewallRulesDialog::addRule(QString description, syntax_func rule_func, ad
ui->textBrowser->append(comment_line); ui->textBrowser->append(comment_line);
ui->textBrowser->append(rule_str->str); ui->textBrowser->append(rule_str->str);
g_string_free(rule_str, true); g_string_free(rule_str, TRUE);
} }

View File

@ -374,7 +374,7 @@ register_tap_listener_qt_gsm_map_summary(void)
if (err_p != NULL) if (err_p != NULL)
{ {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_p->str); simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_p->str);
g_string_free(err_p, true); g_string_free(err_p, TRUE);
exit(1); exit(1);
} }

View File

@ -2128,7 +2128,7 @@ IOGraph::IOGraph(QCustomPlot *parent) :
// QMessageBox::critical(this, tr("%1 failed to register tap listener").arg(name_), // QMessageBox::critical(this, tr("%1 failed to register tap listener").arg(name_),
// error_string->str); // error_string->str);
// config_err_ = error_string->str; // config_err_ = error_string->str;
g_string_free(error_string, true); g_string_free(error_string, TRUE);
tap_registered_ = false; tap_registered_ = false;
} }
} }
@ -2179,7 +2179,7 @@ bool IOGraph::setFilter(const QString &filter)
error_string = check_field_unit(vu_field_.toUtf8().constData(), NULL, val_units_); error_string = check_field_unit(vu_field_.toUtf8().constData(), NULL, val_units_);
if (error_string) { if (error_string) {
config_err_ = error_string->str; config_err_ = error_string->str;
g_string_free(error_string, true); g_string_free(error_string, TRUE);
return false; return false;
} }
@ -2197,7 +2197,7 @@ bool IOGraph::setFilter(const QString &filter)
error_string = set_tap_dfilter(this, full_filter.toUtf8().constData()); error_string = set_tap_dfilter(this, full_filter.toUtf8().constData());
if (error_string) { if (error_string) {
config_err_ = error_string->str; config_err_ = error_string->str;
g_string_free(error_string, true); g_string_free(error_string, TRUE);
return false; return false;
} }

View File

@ -1298,7 +1298,7 @@ void LBMLBTRMTransportDialog::fillTree(void)
{ {
QMessageBox::critical(this, tr("LBT-RM Statistics failed to attach to tap"), QMessageBox::critical(this, tr("LBT-RM Statistics failed to attach to tap"),
error_string->str); error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
reject(); reject();
} }

View File

@ -1717,7 +1717,7 @@ void LBMLBTRUTransportDialog::fillTree(void)
{ {
QMessageBox::critical(this, tr("LBT-RU Statistics failed to attach to tap"), QMessageBox::critical(this, tr("LBT-RU Statistics failed to attach to tap"),
error_string->str); error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
reject(); reject();
} }

View File

@ -377,7 +377,7 @@ void LBMStreamDialog::fillTree(void)
{ {
QMessageBox::critical(this, tr("LBM Stream failed to attach to tap"), QMessageBox::critical(this, tr("LBM Stream failed to attach to tap"),
error_string->str); error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
reject(); reject();
} }

View File

@ -537,7 +537,7 @@ void ManageInterfacesDialog::updateRemoteInterfaceList(GList* rlist, remote_opti
device.selected = true; device.selected = true;
global_capture_opts.num_selected++; global_capture_opts.num_selected++;
g_array_append_val(global_capture_opts.all_ifaces, device); g_array_append_val(global_capture_opts.all_ifaces, device);
g_string_free(ip_str, true); g_string_free(ip_str, TRUE);
} /*for*/ } /*for*/
} }

View File

@ -114,14 +114,14 @@ bool ATapDataModel::enableTap()
GString * errorString = register_tap_listener(tap().toUtf8().constData(), hash(), _filter.toUtf8().constData(), GString * errorString = register_tap_listener(tap().toUtf8().constData(), hash(), _filter.toUtf8().constData(),
TL_IGNORE_DISPLAY_FILTER, &ATapDataModel::tapReset, conversationPacketHandler(), &ATapDataModel::tapDraw, nullptr); TL_IGNORE_DISPLAY_FILTER, &ATapDataModel::tapReset, conversationPacketHandler(), &ATapDataModel::tapDraw, nullptr);
if (errorString && errorString->len > 0) { if (errorString && errorString->len > 0) {
g_string_free(errorString, true); g_string_free(errorString, TRUE);
_disableTap = true; _disableTap = true;
emit tapListenerChanged(false); emit tapListenerChanged(false);
return false; return false;
} }
if (errorString) if (errorString)
g_string_free(errorString, true); g_string_free(errorString, TRUE);
emit tapListenerChanged(true); emit tapListenerChanged(true);
@ -295,7 +295,7 @@ void ATapDataModel::setFilter(QString filter)
} }
if (errorString) if (errorString)
g_string_free(errorString, true); g_string_free(errorString, TRUE);
} }
QString ATapDataModel::filter() const QString ATapDataModel::filter() const

View File

@ -196,7 +196,7 @@ void ExportObjectModel::saveAllEntries(QString path)
EXPORT_OBJECT_MAXFILELEN, count); EXPORT_OBJECT_MAXFILELEN, count);
} }
filename = QString::fromUtf8(safe_filename->str); filename = QString::fromUtf8(safe_filename->str);
g_string_free(safe_filename, true); g_string_free(safe_filename, TRUE);
} while (save_dir.exists(filename) && ++count < prefs.gui_max_export_objects); } while (save_dir.exists(filename) && ++count < prefs.gui_max_export_objects);
write_file_binary_mode(qUtf8Printable(save_dir.filePath(filename)), write_file_binary_mode(qUtf8Printable(save_dir.filePath(filename)),
entry->payload_data, entry->payload_len); entry->payload_data, entry->payload_len);

View File

@ -376,7 +376,7 @@ register_tap_listener_qt_mtp3_summary(void)
if (err_p != NULL) if (err_p != NULL)
{ {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_p->str); simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_p->str);
g_string_free(err_p, true); g_string_free(err_p, TRUE);
exit(1); exit(1);
} }

View File

@ -252,7 +252,7 @@ MulticastStatisticsDialog::MulticastStatisticsDialog(QWidget &parent, CaptureFil
if (error_string != NULL) { if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"%s", error_string->str); "%s", error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
exit(1); exit(1);
} }

View File

@ -463,7 +463,7 @@ void RtpPlayerDialog::retapPackets()
error_string = register_tap_listener("rtp", this, NULL, 0, NULL, tapPacket, NULL, NULL); error_string = register_tap_listener("rtp", this, NULL, 0, NULL, tapPacket, NULL, NULL);
if (error_string) { if (error_string) {
report_failure("RTP Player - tap registration failed: %s", error_string->str); report_failure("RTP Player - tap registration failed: %s", error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
unlockUI(); unlockUI();
return; return;
} }

View File

@ -640,7 +640,7 @@ void SequenceDialog::fillDiagram()
NULL, sequence_analysis_get_packet_func(analysis), NULL, NULL); NULL, sequence_analysis_get_packet_func(analysis), NULL, NULL);
if (error_string) { if (error_string) {
report_failure("Sequence dialog - tap registration failed: %s", error_string->str); report_failure("Sequence dialog - tap registration failed: %s", error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
} }
cf_retap_packets(cap_file_.capFile()); cf_retap_packets(cap_file_.capFile());

View File

@ -68,7 +68,7 @@ QByteArray gchar_free_to_qbytearray(char *glib_string)
QByteArray gstring_free_to_qbytearray(GString *glib_gstring) QByteArray gstring_free_to_qbytearray(GString *glib_gstring)
{ {
QByteArray qt_ba(glib_gstring->str); QByteArray qt_ba(glib_gstring->str);
g_string_free(glib_gstring, true); g_string_free(glib_gstring, TRUE);
return qt_ba; return qt_ba;
} }

View File

@ -505,7 +505,7 @@ void VoipCallsDialog::prepareFilter()
if (filter_length < max_filter_length) { if (filter_length < max_filter_length) {
gtk_editable_insert_text(GTK_EDITABLE(main_display_filter_widget), filter_string_fwd->str, -1, &pos); gtk_editable_insert_text(GTK_EDITABLE(main_display_filter_widget), filter_string_fwd->str, -1, &pos);
} else { } else {
g_string_free(filter_string_fwd, true); g_string_free(filter_string_fwd, TRUE);
filter_string_fwd = g_string_new(filter_prepend); filter_string_fwd = g_string_new(filter_prepend);
g_string_append_printf(filter_string_fwd, "("); g_string_append_printf(filter_string_fwd, "(");

View File

@ -300,7 +300,7 @@ void WirelessTimeline::appInitialized()
error_string = register_tap_listener("wlan_radio_timeline", this, NULL, TL_REQUIRES_NOTHING, tap_timeline_reset, tap_timeline_packet, NULL/*tap_draw_cb tap_draw*/, NULL); error_string = register_tap_listener("wlan_radio_timeline", this, NULL, TL_REQUIRES_NOTHING, tap_timeline_reset, tap_timeline_packet, NULL/*tap_draw_cb tap_draw*/, NULL);
if (error_string) { if (error_string) {
report_failure("Wireless Timeline - tap registration failed: %s", error_string->str); report_failure("Wireless Timeline - tap registration failed: %s", error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
} }
} }

View File

@ -100,7 +100,7 @@ bool WiresharkDialog::registerTapListener(const char *tap_name, void *tap_data,
if (error_string) { if (error_string) {
QMessageBox::warning(this, tr("Failed to attach to tap \"%1\"").arg(tap_name), QMessageBox::warning(this, tr("Failed to attach to tap \"%1\"").arg(tap_name),
error_string->str); error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
return false; return false;
} }

View File

@ -990,7 +990,7 @@ void WiresharkMainWindow::pushLiveCaptureInProgress() {
if (capture_opts->save_file) if (capture_opts->save_file)
msgtip += capture_opts->save_file; msgtip += capture_opts->save_file;
mainApp->pushStatus(WiresharkApplication::FileStatus, msg, msgtip); mainApp->pushStatus(WiresharkApplication::FileStatus, msg, msgtip);
g_string_free(interface_names, true); g_string_free(interface_names, TRUE);
#endif // HAVE_LIBPCAP #endif // HAVE_LIBPCAP
} }

View File

@ -89,7 +89,7 @@ static char *get_appcast_update_url(software_update_channel_e chan) {
SU_OSNAME, SU_OSNAME,
SU_ARCH, SU_ARCH,
chan_name); chan_name);
return g_string_free(update_url_str, false); return g_string_free(update_url_str, FALSE);
} }
#ifdef _WIN32 #ifdef _WIN32

View File

@ -146,7 +146,7 @@ ssl_export_sessions(size_t *length)
} }
*length = keylist->len; *length = keylist->len;
return g_string_free(keylist, false); return g_string_free(keylist, FALSE);
} }
void void

View File

@ -133,7 +133,7 @@ rlc_3gpp_tap_info* select_rlc_lte_session(capture_file *cf,
if (error_string){ if (error_string){
fprintf(stderr, "wireshark: Couldn't register rlc_lte_graph tap: %s\n", fprintf(stderr, "wireshark: Couldn't register rlc_lte_graph tap: %s\n",
error_string->str); error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
dfilter_free(sfcode); dfilter_free(sfcode);
exit(1); /* XXX: fix this */ exit(1); /* XXX: fix this */
} }
@ -290,7 +290,7 @@ bool rlc_graph_segment_list_get(capture_file *cf, struct rlc_graph *g, bool stre
if (error_string) { if (error_string) {
fprintf(stderr, "wireshark: Couldn't register rlc_graph tap: %s\n", fprintf(stderr, "wireshark: Couldn't register rlc_graph tap: %s\n",
error_string->str); error_string->str);
g_string_free(error_string, true); g_string_free(error_string, TRUE);
exit(1); /* XXX: fix this */ exit(1); /* XXX: fix this */
} }
cf_retap_packets(cf); cf_retap_packets(cf);

Some files were not shown because too many files have changed in this diff Show More