forked from osmocom/wireshark
Remove superfluous null-checks before strdup/free
NULL checks were removed for following free functions: - g_free "If mem is NULL it simply returns" https://developer.gnome.org/glib/stable/glib-Memory-Allocation.html#g-free - g_slist_free(_full)? "NULL is considered to be the empty list" https://developer.gnome.org/glib/stable/glib-Singly-Linked-Lists.html - g_strfreev "If str_array is NULL, this function simply returns." https://developer.gnome.org/glib/stable/glib-String-Utility-Functions.html#g-strfreev - g_slice_free "If mem is NULL, this macro does nothing." https://developer.gnome.org/glib/stable/glib-Memory-Slices.html#g-slice-free - g_match_info_free "not NULL... otherwise does nothing" https://developer.gnome.org/glib/stable/glib-Perl-compatible-regular-expressions.html#g-match-info-free - dfilter_free defined in Wireshark code. Returns early when passed NULL epan/dfilter/dfilter.c They were also removed around calls to g_strdup where applicable: - g_strdup "If str is NULL it returns NULL." https://developer.gnome.org/glib/stable/glib-String-Utility-Functions.html#g-strdup Change-Id: Ie80c2db89bef531edc3aed7b7c9f654e1d654d04 Reviewed-on: https://code.wireshark.org/review/23406 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
This commit is contained in:
parent
37ccb77a1a
commit
9d49e13166
|
@ -1152,8 +1152,7 @@ capture_opts_del_iface(capture_options *capture_opts, guint if_index)
|
|||
|
||||
g_free(interface_opts->name);
|
||||
g_free(interface_opts->descr);
|
||||
if (interface_opts->console_display_name != NULL)
|
||||
g_free(interface_opts->console_display_name);
|
||||
g_free(interface_opts->console_display_name);
|
||||
g_free(interface_opts->cfilter);
|
||||
g_free(interface_opts->timestamp_type);
|
||||
#ifdef HAVE_EXTCAP
|
||||
|
|
|
@ -780,11 +780,9 @@ free_airpcap_if_cb(gpointer data, gpointer user_data _U_)
|
|||
if (NULL == if_info)
|
||||
return;
|
||||
|
||||
if (if_info->name != NULL)
|
||||
g_free(if_info->name);
|
||||
g_free(if_info->name);
|
||||
|
||||
if (if_info->description != NULL)
|
||||
g_free(if_info->description);
|
||||
g_free(if_info->description);
|
||||
|
||||
/* XXX - FREE THE WEP KEY LIST HERE!!!*/
|
||||
if (if_info->keysCollection != NULL)
|
||||
|
@ -793,8 +791,7 @@ free_airpcap_if_cb(gpointer data, gpointer user_data _U_)
|
|||
if_info->keysCollection = NULL;
|
||||
}
|
||||
|
||||
if (if_info->ip_addr != NULL)
|
||||
g_slist_free(if_info->ip_addr);
|
||||
g_slist_free(if_info->ip_addr);
|
||||
|
||||
g_free(if_info);
|
||||
}
|
||||
|
@ -1107,11 +1104,9 @@ airpcap_if_info_free(airpcap_if_info_t *if_info)
|
|||
{
|
||||
if (if_info != NULL)
|
||||
{
|
||||
if (if_info->name != NULL)
|
||||
g_free(if_info->name);
|
||||
g_free(if_info->name);
|
||||
|
||||
if (if_info->description != NULL)
|
||||
g_free(if_info->description);
|
||||
g_free(if_info->description);
|
||||
|
||||
if (if_info->keysCollection != NULL)
|
||||
{
|
||||
|
@ -1125,10 +1120,7 @@ airpcap_if_info_free(airpcap_if_info_t *if_info)
|
|||
if_info->ip_addr = NULL;
|
||||
}
|
||||
|
||||
if (if_info != NULL)
|
||||
{
|
||||
g_free(if_info);
|
||||
}
|
||||
g_free(if_info);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -173,10 +173,8 @@ color_filters_set_tmp(guint8 filt_nr, const gchar *filter, gboolean disabled, gc
|
|||
g_free(local_err_msg);
|
||||
return FALSE;
|
||||
} else {
|
||||
if (colorf->filter_text != NULL)
|
||||
g_free(colorf->filter_text);
|
||||
if (colorf->c_colorfilter != NULL)
|
||||
dfilter_free(colorf->c_colorfilter);
|
||||
g_free(colorf->filter_text);
|
||||
dfilter_free(colorf->c_colorfilter);
|
||||
colorf->filter_text = g_strdup(tmpfilter);
|
||||
colorf->c_colorfilter = compiled_filter;
|
||||
colorf->disabled = ((i!=filt_nr) ? TRUE : disabled);
|
||||
|
@ -225,12 +223,9 @@ color_filters_reset_tmp(gchar **err_msg)
|
|||
void
|
||||
color_filter_delete(color_filter_t *colorf)
|
||||
{
|
||||
if (colorf->filter_name != NULL)
|
||||
g_free(colorf->filter_name);
|
||||
if (colorf->filter_text != NULL)
|
||||
g_free(colorf->filter_text);
|
||||
if (colorf->c_colorfilter != NULL)
|
||||
dfilter_free(colorf->c_colorfilter);
|
||||
g_free(colorf->filter_name);
|
||||
g_free(colorf->filter_text);
|
||||
dfilter_free(colorf->c_colorfilter);
|
||||
g_free(colorf);
|
||||
}
|
||||
|
||||
|
|
|
@ -2088,8 +2088,7 @@ parse_key_string(gchar* input_string, guint8 key_type)
|
|||
g_byte_array_free(ssid_ba, TRUE);
|
||||
|
||||
g_free(key);
|
||||
if(ssid != NULL)
|
||||
g_free(ssid);
|
||||
g_free(ssid);
|
||||
|
||||
/* Free the array of strings */
|
||||
g_strfreev(tokens);
|
||||
|
|
|
@ -184,7 +184,7 @@ static gchar* dfilter_macro_apply_recurse(const gchar* text, guint depth, gchar*
|
|||
FGS(name); \
|
||||
FGS(arg); \
|
||||
if (args) { \
|
||||
while(args->len) { void* p = g_ptr_array_remove_index_fast(args,0); if (p) g_free(p); } \
|
||||
while(args->len) { void* p = g_ptr_array_remove_index_fast(args,0); g_free(p); } \
|
||||
g_ptr_array_free(args,TRUE); \
|
||||
args = NULL; \
|
||||
} \
|
||||
|
|
|
@ -251,10 +251,7 @@ read_keytab_file_from_preferences(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (last_keytab != NULL) {
|
||||
g_free(last_keytab);
|
||||
last_keytab = NULL;
|
||||
}
|
||||
g_free(last_keytab);
|
||||
last_keytab = g_strdup(keytab_filename);
|
||||
|
||||
read_keytab_file(last_keytab);
|
||||
|
@ -620,9 +617,9 @@ clear_keytab(void) {
|
|||
for(ske = service_key_list; ske != NULL; ske = g_slist_next(ske)){
|
||||
sk = (service_key_t *) ske->data;
|
||||
if (sk) {
|
||||
g_free(sk->contents);
|
||||
g_free(sk);
|
||||
}
|
||||
g_free(sk->contents);
|
||||
g_free(sk);
|
||||
}
|
||||
}
|
||||
g_slist_free(service_key_list);
|
||||
service_key_list = NULL;
|
||||
|
|
|
@ -515,8 +515,8 @@ attribute_types_free_cb(void*r)
|
|||
{
|
||||
attribute_type_t* rec = (attribute_type_t*)r;
|
||||
|
||||
if (rec->attribute_type) g_free(rec->attribute_type);
|
||||
if (rec->attribute_desc) g_free(rec->attribute_desc);
|
||||
g_free(rec->attribute_type);
|
||||
g_free(rec->attribute_desc);
|
||||
}
|
||||
|
||||
UAT_CSTRING_CB_DEF(attribute_types, attribute_type, attribute_type_t)
|
||||
|
|
|
@ -513,13 +513,8 @@ void
|
|||
ber_decode_as(const gchar *syntax)
|
||||
{
|
||||
|
||||
if (decode_as_syntax) {
|
||||
g_free(decode_as_syntax);
|
||||
decode_as_syntax = NULL;
|
||||
}
|
||||
|
||||
if (syntax)
|
||||
decode_as_syntax = g_strdup(syntax);
|
||||
g_free(decode_as_syntax);
|
||||
decode_as_syntax = g_strdup(syntax);
|
||||
}
|
||||
|
||||
/* Get oid syntax from hash table to get translation in proto dissection(packet-per.c) */
|
||||
|
|
|
@ -1487,11 +1487,7 @@ static void* uat_bootp_record_copy_cb(void* n, const void* o, size_t siz _U_) {
|
|||
uat_bootp_record_t* new_record = (uat_bootp_record_t *)n;
|
||||
const uat_bootp_record_t* old_record = (const uat_bootp_record_t *)o;
|
||||
|
||||
if (old_record->text) {
|
||||
new_record->text = g_strdup(old_record->text);
|
||||
} else {
|
||||
new_record->text = NULL;
|
||||
}
|
||||
new_record->text = g_strdup(old_record->text);
|
||||
|
||||
return new_record;
|
||||
}
|
||||
|
@ -1509,7 +1505,7 @@ static gboolean uat_bootp_record_update_cb(void* r, char** err) {
|
|||
static void uat_bootp_record_free_cb(void*r) {
|
||||
uat_bootp_record_t* rec = (uat_bootp_record_t *)r;
|
||||
|
||||
if (rec->text) g_free(rec->text);
|
||||
g_free(rec->text);
|
||||
}
|
||||
|
||||
UAT_DEC_CB_DEF(uat_bootp_records, opt, uat_bootp_record_t)
|
||||
|
|
|
@ -481,10 +481,7 @@ proto_reg_handoff_corosync_totemnet(void)
|
|||
initialized = TRUE;
|
||||
}
|
||||
|
||||
if (corosync_totemnet_private_keys_list) {
|
||||
g_strfreev(corosync_totemnet_private_keys_list);
|
||||
corosync_totemnet_private_keys_list = NULL;
|
||||
}
|
||||
g_strfreev(corosync_totemnet_private_keys_list);
|
||||
corosync_totemnet_private_keys_list = g_strsplit(corosync_totemnet_private_keys, ";", 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1128,8 +1128,7 @@ dcerpc_fragment_free_temporary_key(gpointer ptr)
|
|||
{
|
||||
dcerpc_fragment_key *key = (dcerpc_fragment_key *)ptr;
|
||||
|
||||
if (key)
|
||||
g_slice_free(dcerpc_fragment_key, key);
|
||||
g_slice_free(dcerpc_fragment_key, key);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -3118,9 +3117,7 @@ dissect_deferred_pointers(packet_info *pinfo, tvbuff_t *tvb, int offset, dcerpc_
|
|||
} while (found_new_pointer);
|
||||
DISSECTOR_ASSERT(original_depth == current_depth);
|
||||
|
||||
if (ndr_pointer_list) {
|
||||
g_slist_free_full(ndr_pointer_list, g_free);
|
||||
}
|
||||
g_slist_free_full(ndr_pointer_list, g_free);
|
||||
ndr_pointer_list = (GSList *)g_slist_nth_data(list_ndr_pointer_list, current_depth);
|
||||
len_ndr_pointer_list = g_slist_length(ndr_pointer_list);
|
||||
|
||||
|
|
|
@ -3409,32 +3409,9 @@ static void* secmode_list_copy_cb(void *n, const void *o, size_t siz _U_)
|
|||
secmode_field_t *new_rec = (secmode_field_t *)n;
|
||||
const secmode_field_t *old_rec = (const secmode_field_t *)o;
|
||||
|
||||
if (old_rec->domain)
|
||||
{
|
||||
new_rec->domain = g_strdup(old_rec->domain);
|
||||
}
|
||||
else
|
||||
{
|
||||
new_rec->domain = NULL;
|
||||
}
|
||||
|
||||
if (old_rec->identity)
|
||||
{
|
||||
new_rec->identity = g_strdup(old_rec->identity);
|
||||
}
|
||||
else
|
||||
{
|
||||
new_rec->identity = NULL;
|
||||
}
|
||||
|
||||
if (old_rec->kek)
|
||||
{
|
||||
new_rec->kek = g_strdup(old_rec->kek);
|
||||
}
|
||||
else
|
||||
{
|
||||
new_rec->kek = NULL;
|
||||
}
|
||||
new_rec->domain = g_strdup(old_rec->domain);
|
||||
new_rec->identity = g_strdup(old_rec->identity);
|
||||
new_rec->kek = g_strdup(old_rec->kek);
|
||||
|
||||
return new_rec;
|
||||
}
|
||||
|
@ -3443,12 +3420,9 @@ static void secmode_list_free_cb(void *r)
|
|||
{
|
||||
secmode_field_t *rec = (secmode_field_t *)r;
|
||||
|
||||
if (rec->domain)
|
||||
g_free(rec->domain);
|
||||
if (rec->identity)
|
||||
g_free(rec->identity);
|
||||
if (rec->kek)
|
||||
g_free(rec->kek);
|
||||
g_free(rec->domain);
|
||||
g_free(rec->identity);
|
||||
g_free(rec->kek);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3477,14 +3451,7 @@ static void* seckey_list_copy_cb(void *n, const void *o, size_t siz _U_)
|
|||
seckey_field_t *new_rec = (seckey_field_t *)n;
|
||||
const seckey_field_t *old_rec = (const seckey_field_t *)o;
|
||||
|
||||
if (old_rec->key)
|
||||
{
|
||||
new_rec->key = g_strdup(old_rec->key);
|
||||
}
|
||||
else
|
||||
{
|
||||
new_rec->key = NULL;
|
||||
}
|
||||
new_rec->key = g_strdup(old_rec->key);
|
||||
|
||||
return new_rec;
|
||||
}
|
||||
|
@ -3493,8 +3460,7 @@ static void seckey_list_free_cb(void *r)
|
|||
{
|
||||
seckey_field_t *rec = (seckey_field_t *)r;
|
||||
|
||||
if (rec->key)
|
||||
g_free(rec->key);
|
||||
g_free(rec->key);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3557,32 +3523,9 @@ static void* identsecret_list_copy_cb(void *n, const void *o, size_t siz _U_)
|
|||
identsecret_field_t *new_rec = (identsecret_field_t *)n;
|
||||
const identsecret_field_t *old_rec = (const identsecret_field_t *)o;
|
||||
|
||||
if (old_rec->domain)
|
||||
{
|
||||
new_rec->domain = g_strdup(old_rec->domain);
|
||||
}
|
||||
else
|
||||
{
|
||||
new_rec->domain = NULL;
|
||||
}
|
||||
|
||||
if (old_rec->identity)
|
||||
{
|
||||
new_rec->identity = g_strdup(old_rec->identity);
|
||||
}
|
||||
else
|
||||
{
|
||||
new_rec->identity = NULL;
|
||||
}
|
||||
|
||||
if (old_rec->secret)
|
||||
{
|
||||
new_rec->secret = g_strdup(old_rec->secret);
|
||||
}
|
||||
else
|
||||
{
|
||||
new_rec->secret = NULL;
|
||||
}
|
||||
new_rec->domain = g_strdup(old_rec->domain);
|
||||
new_rec->identity = g_strdup(old_rec->identity);
|
||||
new_rec->secret = g_strdup(old_rec->secret);
|
||||
|
||||
return new_rec;
|
||||
}
|
||||
|
@ -3591,12 +3534,9 @@ static void identsecret_list_free_cb(void *r)
|
|||
{
|
||||
identsecret_field_t *rec = (identsecret_field_t *)r;
|
||||
|
||||
if (rec->domain)
|
||||
g_free(rec->domain);
|
||||
if (rec->identity)
|
||||
g_free(rec->identity);
|
||||
if (rec->secret)
|
||||
g_free(rec->secret);
|
||||
g_free(rec->domain);
|
||||
g_free(rec->identity);
|
||||
g_free(rec->secret);
|
||||
}
|
||||
|
||||
static void init_addr_port_tables(void);
|
||||
|
|
|
@ -6351,14 +6351,8 @@ proto_reg_handoff_dvbci(void)
|
|||
tcp_dissector_table = find_dissector_table("tcp.port");
|
||||
udp_dissector_table = find_dissector_table("udp.port");
|
||||
|
||||
if (dvbci_sek_bin) {
|
||||
g_free(dvbci_sek_bin);
|
||||
dvbci_sek_bin = NULL;
|
||||
}
|
||||
if (dvbci_siv_bin) {
|
||||
g_free(dvbci_siv_bin);
|
||||
dvbci_siv_bin = NULL;
|
||||
}
|
||||
g_free(dvbci_sek_bin);
|
||||
g_free(dvbci_siv_bin);
|
||||
pref_key_string_to_bin(dvbci_sek, &dvbci_sek_bin);
|
||||
pref_key_string_to_bin(dvbci_siv, &dvbci_siv_bin);
|
||||
}
|
||||
|
|
|
@ -2324,9 +2324,7 @@ static void
|
|||
free_key(gpointer ptr)
|
||||
{
|
||||
duplication_key *key = (duplication_key *)ptr;
|
||||
|
||||
if(key)
|
||||
g_slice_free(duplication_key, key);
|
||||
g_slice_free(duplication_key, key);
|
||||
}
|
||||
|
||||
/* removes the table entries of a specific transfer */
|
||||
|
|
|
@ -445,9 +445,7 @@ static void
|
|||
sm_fragment_free_temporary_key(gpointer ptr)
|
||||
{
|
||||
sm_fragment_key *key = (sm_fragment_key *)ptr;
|
||||
|
||||
if(key)
|
||||
g_slice_free(sm_fragment_key, key);
|
||||
g_slice_free(sm_fragment_key, key);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -211,17 +211,8 @@ header_fields_copy_cb(void* n, const void* o, size_t siz _U_)
|
|||
header_field_t* new_rec = (header_field_t*)n;
|
||||
const header_field_t* old_rec = (const header_field_t*)o;
|
||||
|
||||
if (old_rec->header_name) {
|
||||
new_rec->header_name = g_strdup(old_rec->header_name);
|
||||
} else {
|
||||
new_rec->header_name = NULL;
|
||||
}
|
||||
|
||||
if (old_rec->header_desc) {
|
||||
new_rec->header_desc = g_strdup(old_rec->header_desc);
|
||||
} else {
|
||||
new_rec->header_desc = NULL;
|
||||
}
|
||||
new_rec->header_name = g_strdup(old_rec->header_name);
|
||||
new_rec->header_desc = g_strdup(old_rec->header_desc);
|
||||
|
||||
return new_rec;
|
||||
}
|
||||
|
@ -231,10 +222,8 @@ header_fields_free_cb(void*r)
|
|||
{
|
||||
header_field_t* rec = (header_field_t*)r;
|
||||
|
||||
if (rec->header_name)
|
||||
g_free(rec->header_name);
|
||||
if (rec->header_desc)
|
||||
g_free(rec->header_desc);
|
||||
g_free(rec->header_name);
|
||||
g_free(rec->header_desc);
|
||||
}
|
||||
|
||||
UAT_CSTRING_CB_DEF(header_fields, header_name, header_field_t)
|
||||
|
|
|
@ -146,11 +146,7 @@ uat_wep_key_record_copy_cb(void* n, const void* o, size_t siz _U_)
|
|||
uat_wep_key_record_t* new_key = (uat_wep_key_record_t *)n;
|
||||
const uat_wep_key_record_t* old_key = (const uat_wep_key_record_t *)o;
|
||||
|
||||
if (old_key->string) {
|
||||
new_key->string = g_strdup(old_key->string);
|
||||
} else {
|
||||
new_key->string = NULL;
|
||||
}
|
||||
new_key->string = g_strdup(old_key->string);
|
||||
|
||||
return new_key;
|
||||
}
|
||||
|
@ -210,8 +206,7 @@ static void
|
|||
uat_wep_key_record_free_cb(void*r)
|
||||
{
|
||||
uat_wep_key_record_t* key = (uat_wep_key_record_t *)r;
|
||||
|
||||
if (key->string) g_free(key->string);
|
||||
g_free(key->string);
|
||||
}
|
||||
|
||||
UAT_VS_DEF(uat_wep_key_records, key, uat_wep_key_record_t, guint8, 0, STRING_KEY_TYPE_WEP)
|
||||
|
|
|
@ -354,13 +354,13 @@ static void* uat_esp_sa_record_copy_cb(void* n, const void* o, size_t siz _U_) {
|
|||
|
||||
/* Copy UAT fields */
|
||||
new_rec->protocol = old_rec->protocol;
|
||||
new_rec->srcIP = (old_rec->srcIP) ? g_strdup(old_rec->srcIP) : NULL;
|
||||
new_rec->dstIP = (old_rec->dstIP) ? g_strdup(old_rec->dstIP) : NULL;
|
||||
new_rec->spi = (old_rec->spi) ? g_strdup(old_rec->spi) : NULL;
|
||||
new_rec->srcIP = g_strdup(old_rec->srcIP);
|
||||
new_rec->dstIP = g_strdup(old_rec->dstIP);
|
||||
new_rec->spi = g_strdup(old_rec->spi);
|
||||
new_rec->encryption_algo = old_rec->encryption_algo;
|
||||
new_rec->encryption_key_string = (old_rec->encryption_key_string) ? g_strdup(old_rec->encryption_key_string) : NULL;
|
||||
new_rec->encryption_key_string = g_strdup(old_rec->encryption_key_string);
|
||||
new_rec->authentication_algo = old_rec->authentication_algo;
|
||||
new_rec->authentication_key_string = (old_rec->authentication_key_string) ? g_strdup(old_rec->authentication_key_string) : NULL;
|
||||
new_rec->authentication_key_string = g_strdup(old_rec->authentication_key_string);
|
||||
|
||||
/* Parse keys as in an update */
|
||||
uat_esp_sa_record_update_cb(new_rec, NULL);
|
||||
|
@ -431,12 +431,7 @@ void esp_sa_record_add_from_dissector(guint8 protocol, const gchar *srcIP, const
|
|||
|
||||
/* Authentication */
|
||||
record->authentication_algo = authentication_algo;
|
||||
if (authentication_key) {
|
||||
record->authentication_key_string = g_strdup(authentication_key);
|
||||
}
|
||||
else {
|
||||
record->authentication_key_string = NULL;
|
||||
}
|
||||
record->authentication_key_string = g_strdup(authentication_key);
|
||||
|
||||
/* Parse keys */
|
||||
uat_esp_sa_record_update_cb(record, NULL);
|
||||
|
|
|
@ -510,10 +510,7 @@ read_keytab_file_from_preferences(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (last_keytab != NULL) {
|
||||
g_free(last_keytab);
|
||||
last_keytab = NULL;
|
||||
}
|
||||
g_free(last_keytab);
|
||||
last_keytab = g_strdup(keytab_filename);
|
||||
|
||||
read_keytab_file(last_keytab);
|
||||
|
@ -879,9 +876,9 @@ clear_keytab(void) {
|
|||
for(ske = service_key_list; ske != NULL; ske = g_slist_next(ske)){
|
||||
sk = (service_key_t *) ske->data;
|
||||
if (sk) {
|
||||
g_free(sk->contents);
|
||||
g_free(sk);
|
||||
}
|
||||
g_free(sk->contents);
|
||||
g_free(sk);
|
||||
}
|
||||
}
|
||||
g_slist_free(service_key_list);
|
||||
service_key_list = NULL;
|
||||
|
|
|
@ -3197,8 +3197,7 @@ static void l2tp_cleanup(void)
|
|||
GSList *iterator = list_heads;
|
||||
|
||||
while (iterator) {
|
||||
if (iterator->data != NULL)
|
||||
g_slist_free((GSList *)iterator->data);
|
||||
g_slist_free((GSList *)iterator->data);
|
||||
iterator = g_slist_next(iterator);
|
||||
}
|
||||
|
||||
|
|
|
@ -729,8 +729,8 @@ attribute_types_free_cb(void*r)
|
|||
{
|
||||
attribute_type_t* rec = (attribute_type_t*)r;
|
||||
|
||||
if (rec->attribute_type) g_free(rec->attribute_type);
|
||||
if (rec->attribute_desc) g_free(rec->attribute_desc);
|
||||
g_free(rec->attribute_type);
|
||||
g_free(rec->attribute_desc);
|
||||
}
|
||||
|
||||
UAT_CSTRING_CB_DEF(attribute_types, attribute_type, attribute_type_t)
|
||||
|
|
|
@ -204,9 +204,9 @@ static void* uat_ue_keys_record_copy_cb(void* n, const void* o, size_t siz _U_)
|
|||
const uat_ue_keys_record_t* old_rec = (const uat_ue_keys_record_t *)o;
|
||||
|
||||
new_rec->ueid = old_rec->ueid;
|
||||
new_rec->rrcCipherKeyString = (old_rec->rrcCipherKeyString) ? g_strdup(old_rec->rrcCipherKeyString) : NULL;
|
||||
new_rec->upCipherKeyString = (old_rec->upCipherKeyString) ? g_strdup(old_rec->upCipherKeyString) : NULL;
|
||||
new_rec->rrcIntegrityKeyString = (old_rec->rrcIntegrityKeyString) ? g_strdup(old_rec->rrcIntegrityKeyString) : NULL;
|
||||
new_rec->rrcCipherKeyString = g_strdup(old_rec->rrcCipherKeyString);
|
||||
new_rec->upCipherKeyString = g_strdup(old_rec->upCipherKeyString);
|
||||
new_rec->rrcIntegrityKeyString = g_strdup(old_rec->rrcIntegrityKeyString);
|
||||
|
||||
return new_rec;
|
||||
}
|
||||
|
|
|
@ -748,19 +748,14 @@ static void* uat_kindid_copy_cb(void* n, const void* o, size_t siz _U_) {
|
|||
kind_t * new_record = (kind_t *)n;
|
||||
const kind_t* old_record = (const kind_t *)o;
|
||||
|
||||
if (old_record->name) {
|
||||
new_record->name = g_strdup(old_record->name);
|
||||
} else {
|
||||
new_record->name = NULL;
|
||||
}
|
||||
new_record->name = g_strdup(old_record->name);
|
||||
|
||||
return new_record;
|
||||
}
|
||||
|
||||
static void uat_kindid_record_free_cb(void*r) {
|
||||
kind_t* rec = (kind_t *)r;
|
||||
|
||||
if (rec->name) g_free(rec->name);
|
||||
g_free(rec->name);
|
||||
}
|
||||
|
||||
UAT_DEC_CB_DEF(kindidlist_uats,id,kind_t)
|
||||
|
|
|
@ -521,11 +521,7 @@ static void *sctp_chunk_type_copy_cb(void* n, const void* o, size_t siz _U_)
|
|||
{
|
||||
type_field_t* new_rec = (type_field_t*)n;
|
||||
const type_field_t* old_rec = (const type_field_t*)o;
|
||||
if (old_rec->type_name) {
|
||||
new_rec->type_name = g_strdup(old_rec->type_name);
|
||||
} else {
|
||||
new_rec->type_name = NULL;
|
||||
}
|
||||
new_rec->type_name = g_strdup(old_rec->type_name);
|
||||
|
||||
return new_rec;
|
||||
}
|
||||
|
@ -534,7 +530,7 @@ static void
|
|||
sctp_chunk_type_free_cb(void* r)
|
||||
{
|
||||
type_field_t* rec = (type_field_t*)r;
|
||||
if (rec->type_name) g_free(rec->type_name);
|
||||
g_free(rec->type_name);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
@ -954,17 +954,8 @@ header_fields_copy_cb(void* n, const void* o, size_t siz _U_)
|
|||
header_field_t* new_rec = (header_field_t*)n;
|
||||
const header_field_t* old_rec = (const header_field_t*)o;
|
||||
|
||||
if (old_rec->header_name) {
|
||||
new_rec->header_name = g_strdup(old_rec->header_name);
|
||||
} else {
|
||||
new_rec->header_name = NULL;
|
||||
}
|
||||
|
||||
if (old_rec->header_desc) {
|
||||
new_rec->header_desc = g_strdup(old_rec->header_desc);
|
||||
} else {
|
||||
new_rec->header_desc = NULL;
|
||||
}
|
||||
new_rec->header_name = g_strdup(old_rec->header_name);
|
||||
new_rec->header_desc = g_strdup(old_rec->header_desc);
|
||||
|
||||
return new_rec;
|
||||
}
|
||||
|
@ -1078,23 +1069,9 @@ authorization_users_copy_cb(void* n, const void* o, size_t siz _U_)
|
|||
authorization_user_t* new_rec = (authorization_user_t*)n;
|
||||
const authorization_user_t* old_rec = (const authorization_user_t*)o;
|
||||
|
||||
if (old_rec->username) {
|
||||
new_rec->username = g_strdup(old_rec->username);
|
||||
} else {
|
||||
new_rec->username = NULL;
|
||||
}
|
||||
|
||||
if (old_rec->realm) {
|
||||
new_rec->realm = g_strdup(old_rec->realm);
|
||||
} else {
|
||||
new_rec->realm = NULL;
|
||||
}
|
||||
|
||||
if (old_rec->password) {
|
||||
new_rec->password = g_strdup(old_rec->password);
|
||||
} else {
|
||||
new_rec->password = NULL;
|
||||
}
|
||||
new_rec->username = g_strdup(old_rec->username);
|
||||
new_rec->realm = g_strdup(old_rec->realm);
|
||||
new_rec->password = g_strdup(old_rec->password);
|
||||
|
||||
return new_rec;
|
||||
}
|
||||
|
|
|
@ -17348,8 +17348,7 @@ free_hash_tables(gpointer ctarg, gpointer user_data _U_)
|
|||
g_hash_table_destroy(ct->primaries);
|
||||
if (ct->tid_service)
|
||||
g_hash_table_destroy(ct->tid_service);
|
||||
if (ct->GSL_fid_info)
|
||||
g_slist_free(ct->GSL_fid_info);
|
||||
g_slist_free(ct->GSL_fid_info);
|
||||
g_free(ct);
|
||||
}
|
||||
|
||||
|
|
|
@ -147,31 +147,12 @@ user_data_fields_copy_cb(void* n, const void* o, size_t siz _U_)
|
|||
user_data_field_t* new_rec = (user_data_field_t*)n;
|
||||
const user_data_field_t* old_rec = (const user_data_field_t*)o;
|
||||
|
||||
if (old_rec->udf_name) {
|
||||
new_rec->udf_name = g_strdup(old_rec->udf_name);
|
||||
}
|
||||
else {
|
||||
new_rec->udf_name = NULL;
|
||||
}
|
||||
|
||||
if (old_rec->udf_desc) {
|
||||
new_rec->udf_desc = g_strdup(old_rec->udf_desc);
|
||||
}
|
||||
else {
|
||||
new_rec->udf_desc = NULL;
|
||||
}
|
||||
|
||||
new_rec->udf_offset = old_rec->udf_offset;
|
||||
new_rec->udf_length = old_rec->udf_length;
|
||||
|
||||
new_rec->udf_mask = old_rec->udf_mask;
|
||||
|
||||
if (old_rec->udf_value_desc) {
|
||||
new_rec->udf_value_desc = g_strdup(old_rec->udf_value_desc);
|
||||
}
|
||||
else {
|
||||
new_rec->udf_value_desc = NULL;
|
||||
}
|
||||
new_rec->udf_name = g_strdup(old_rec->udf_name);
|
||||
new_rec->udf_desc = g_strdup(old_rec->udf_desc);
|
||||
new_rec->udf_offset = old_rec->udf_offset;
|
||||
new_rec->udf_length = old_rec->udf_length;
|
||||
new_rec->udf_mask = old_rec->udf_mask;
|
||||
new_rec->udf_value_desc = g_strdup(old_rec->udf_value_desc);
|
||||
|
||||
return new_rec;
|
||||
}
|
||||
|
@ -181,9 +162,9 @@ user_data_fields_free_cb(void*r)
|
|||
{
|
||||
user_data_field_t* rec = (user_data_field_t*)r;
|
||||
|
||||
if (rec->udf_name) g_free(rec->udf_name);
|
||||
if (rec->udf_desc) g_free(rec->udf_desc);
|
||||
if (rec->udf_value_desc) g_free(rec->udf_value_desc);
|
||||
g_free(rec->udf_name);
|
||||
g_free(rec->udf_desc);
|
||||
g_free(rec->udf_value_desc);
|
||||
}
|
||||
|
||||
UAT_CSTRING_CB_DEF(user_data_fields, udf_name, user_data_field_t)
|
||||
|
|
|
@ -5834,8 +5834,8 @@ static void *uat_umts_fp_record_copy_cb(void *n, const void *o, size_t siz _U_)
|
|||
uat_umts_fp_ep_and_ch_record_t *new_rec = (uat_umts_fp_ep_and_ch_record_t *)n;
|
||||
const uat_umts_fp_ep_and_ch_record_t *old_rec = (const uat_umts_fp_ep_and_ch_record_t *)o;
|
||||
|
||||
new_rec->srcIP = (old_rec->srcIP) ? g_strdup(old_rec->srcIP) : NULL;
|
||||
new_rec->dstIP = (old_rec->dstIP) ? g_strdup(old_rec->dstIP) : NULL;
|
||||
new_rec->srcIP = g_strdup(old_rec->srcIP);
|
||||
new_rec->dstIP = g_strdup(old_rec->dstIP);
|
||||
|
||||
return new_rec;
|
||||
}
|
||||
|
|
|
@ -550,16 +550,9 @@ uat_key_record_copy_cb(void *n, const void *o, size_t siz _U_)
|
|||
uat_key_record_t *new_key = (uat_key_record_t *)n;
|
||||
const uat_key_record_t *old_key = (const uat_key_record_t *)o;
|
||||
|
||||
if (old_key->string) {
|
||||
new_key->string = g_strdup(old_key->string);
|
||||
} else {
|
||||
new_key->string = NULL;
|
||||
}
|
||||
if (old_key->label) {
|
||||
new_key->label = g_strdup(old_key->label);
|
||||
} else {
|
||||
new_key->label = NULL;
|
||||
}
|
||||
new_key->string = g_strdup(old_key->string);
|
||||
new_key->label = g_strdup(old_key->label);
|
||||
|
||||
return new_key;
|
||||
}
|
||||
|
||||
|
@ -568,12 +561,8 @@ static void
|
|||
uat_key_record_free_cb(void *r)
|
||||
{
|
||||
uat_key_record_t *key = (uat_key_record_t *)r;
|
||||
if (key->string) {
|
||||
g_free(key->string);
|
||||
}
|
||||
if (key->label) {
|
||||
g_free(key->label);
|
||||
}
|
||||
g_free(key->string);
|
||||
g_free(key->label);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -139,18 +139,8 @@ static void* uat_key_record_copy_cb(void* n, const void* o, size_t siz _U_) {
|
|||
uat_key_record_t* new_key = (uat_key_record_t *)n;
|
||||
const uat_key_record_t* old_key = (const uat_key_record_t *)o;
|
||||
|
||||
if (old_key->string) {
|
||||
new_key->string = g_strdup(old_key->string);
|
||||
} else {
|
||||
new_key->string = NULL;
|
||||
}
|
||||
|
||||
if (old_key->label) {
|
||||
new_key->label = g_strdup(old_key->label);
|
||||
} else {
|
||||
new_key->label = NULL;
|
||||
}
|
||||
|
||||
new_key->string = g_strdup(old_key->string);
|
||||
new_key->label = g_strdup(old_key->label);
|
||||
new_key->byte_order = old_key->byte_order;
|
||||
|
||||
return new_key;
|
||||
|
@ -184,8 +174,8 @@ static gboolean uat_key_record_update_cb(void* r, char** err) {
|
|||
static void uat_key_record_free_cb(void*r) {
|
||||
uat_key_record_t* key = (uat_key_record_t *)r;
|
||||
|
||||
if (key->string) g_free(key->string);
|
||||
if (key->label) g_free(key->label);
|
||||
g_free(key->string);
|
||||
g_free(key->label);
|
||||
}
|
||||
|
||||
static void uat_key_record_post_update(void) {
|
||||
|
|
|
@ -62,8 +62,8 @@ static GPtrArray* g_ptr_array_join(GPtrArray* a, GPtrArray* b){
|
|||
%token_destructor {
|
||||
(void) bd; /* Mark unused, similar to Q_UNUSED */
|
||||
if ($$) {
|
||||
if ($$->text) g_free($$->text);
|
||||
if ($$->location) g_free($$->location);
|
||||
g_free($$->text);
|
||||
g_free($$->location);
|
||||
g_free($$);
|
||||
}
|
||||
}
|
||||
|
@ -96,8 +96,7 @@ doctype ::= TAG_START DOCTYPE_KW NAME(Name) OPEN_BRACKET dtd_parts CLOSE_BRACKET
|
|||
bd->proto_name = Name->text;
|
||||
}
|
||||
|
||||
if(bd->proto_root)
|
||||
g_free(bd->proto_root);
|
||||
g_free(bd->proto_root);
|
||||
|
||||
bd->proto_root = Name->text;
|
||||
|
||||
|
|
|
@ -110,10 +110,10 @@ DIAG_OFF(sign-compare)
|
|||
|
||||
static dtd_build_data_t* build_data;
|
||||
|
||||
static void set_proto_name (gchar* val) { if(build_data->proto_name) g_free(build_data->proto_name); build_data->proto_name = g_strdup(val); }
|
||||
static void set_media_type (gchar* val) { if(build_data->media_type) g_free(build_data->media_type); build_data->media_type = g_strdup(val); }
|
||||
static void set_proto_root (gchar* val) { if(build_data->proto_root) g_free(build_data->proto_root); build_data->proto_root = g_strdup(val); }
|
||||
static void set_description (gchar* val) { if(build_data->description) g_free(build_data->description); build_data->description = g_strdup(val); }
|
||||
static void set_proto_name (gchar* val) { g_free(build_data->proto_name); build_data->proto_name = g_strdup(val); }
|
||||
static void set_media_type (gchar* val) { g_free(build_data->media_type); build_data->media_type = g_strdup(val); }
|
||||
static void set_proto_root (gchar* val) { g_free(build_data->proto_root); build_data->proto_root = g_strdup(val); }
|
||||
static void set_description (gchar* val) { g_free(build_data->description); build_data->description = g_strdup(val); }
|
||||
static void set_recursive (gchar* val) { build_data->recursion = ( g_ascii_strcasecmp(val,"yes") == 0 ) ? TRUE : FALSE; }
|
||||
|
||||
#ifdef DEBUG_DTD_PARSER
|
||||
|
@ -244,7 +244,7 @@ squoted ['][^\']*[']
|
|||
<XMLPI>{stop_xmlpi} BEGIN DTD;
|
||||
|
||||
<LOCATION>{get_location_xmlpi} {
|
||||
if(yyextra->location) g_free(yyextra->location);
|
||||
g_free(yyextra->location);
|
||||
yyextra->location = g_strdup(yytext);
|
||||
BEGIN DONE;
|
||||
}
|
||||
|
@ -421,8 +421,7 @@ extern dtd_build_data_t* dtd_parse(GString* s) {
|
|||
|
||||
Dtd_Parse_lex_destroy(scanner);
|
||||
|
||||
if (state.location)
|
||||
g_free(state.location);
|
||||
g_free(state.location);
|
||||
|
||||
DtdParseFree(state.pParser, g_free);
|
||||
|
||||
|
|
|
@ -233,7 +233,7 @@ static const gchar* replace_entity(Dtd_PreParse_scanner_state_t* state, gchar* e
|
|||
const gchar* dtd_location(Dtd_PreParse_scanner_state_t* state) {
|
||||
static gchar* loc = NULL;
|
||||
|
||||
if (loc) g_free(loc);
|
||||
g_free(loc);
|
||||
|
||||
if (!state) return NULL;
|
||||
|
||||
|
|
|
@ -145,11 +145,7 @@ static void *uat_expert_copy_cb(void *n, const void *o, size_t siz _U_)
|
|||
expert_level_entry_t *new_record = (expert_level_entry_t*)n;
|
||||
const expert_level_entry_t *old_record = (const expert_level_entry_t *)o;
|
||||
|
||||
if (old_record->field) {
|
||||
new_record->field = g_strdup(old_record->field);
|
||||
} else {
|
||||
new_record->field = NULL;
|
||||
}
|
||||
new_record->field = g_strdup(old_record->field);
|
||||
|
||||
new_record->severity = old_record->severity;
|
||||
|
||||
|
@ -160,8 +156,7 @@ static void uat_expert_free_cb(void*r)
|
|||
{
|
||||
expert_level_entry_t *rec = (expert_level_entry_t *)r;
|
||||
|
||||
if (rec->field)
|
||||
g_free(rec->field);
|
||||
g_free(rec->field);
|
||||
}
|
||||
|
||||
static void uat_expert_post_update_cb(void)
|
||||
|
|
|
@ -165,13 +165,9 @@ static void geoip_dat_cleanup(void) {
|
|||
* databases as they weren't created by GeoIP_new()
|
||||
* or GeoIP_open() */
|
||||
gi = g_array_index(geoip_dat_arr, GeoIP *, i);
|
||||
if (gi) {
|
||||
g_free(gi);
|
||||
}
|
||||
g_free(gi);
|
||||
gi = g_array_index(geoip_dat_arr, GeoIP *, i+1);
|
||||
if (gi) {
|
||||
g_free(gi);
|
||||
}
|
||||
g_free(gi);
|
||||
/* finally, free the array itself */
|
||||
g_array_free(geoip_dat_arr, TRUE);
|
||||
geoip_dat_arr = NULL;
|
||||
|
|
|
@ -353,8 +353,7 @@ ext_toolbar_add_entry( ext_toolbar_t * parent, ext_toolbar_item_t type, const gc
|
|||
if ( value_list != NULL && g_list_length(value_list) > 0 )
|
||||
entry->values = g_list_copy(value_list);
|
||||
|
||||
if ( regex )
|
||||
entry->regex = g_strdup(regex);
|
||||
entry->regex = g_strdup(regex);
|
||||
|
||||
entry->is_required = is_required;
|
||||
entry->capture_only = capture_only;
|
||||
|
|
24
epan/prefs.c
24
epan/prefs.c
|
@ -3944,9 +3944,9 @@ pre_init_prefs(void)
|
|||
|
||||
prefs.pr_format = PR_FMT_TEXT;
|
||||
prefs.pr_dest = PR_DEST_CMD;
|
||||
if (prefs.pr_file) g_free(prefs.pr_file);
|
||||
g_free(prefs.pr_file);
|
||||
prefs.pr_file = g_strdup("wireshark.out");
|
||||
if (prefs.pr_cmd) g_free(prefs.pr_cmd);
|
||||
g_free(prefs.pr_cmd);
|
||||
prefs.pr_cmd = g_strdup("lpr");
|
||||
|
||||
prefs.gui_altern_colors = FALSE;
|
||||
|
@ -3959,14 +3959,14 @@ pre_init_prefs(void)
|
|||
prefs.gui_toolbar_main_style = TB_STYLE_ICONS;
|
||||
prefs.gui_toolbar_filter_style = TB_STYLE_TEXT;
|
||||
/* These will be g_freed, so they must be g_mallocated. */
|
||||
if (prefs.gui_gtk2_font_name) g_free(prefs.gui_gtk2_font_name);
|
||||
g_free(prefs.gui_gtk2_font_name);
|
||||
#ifdef _WIN32
|
||||
prefs.gui_gtk2_font_name = g_strdup("Lucida Console 10");
|
||||
#else
|
||||
prefs.gui_gtk2_font_name = g_strdup("Monospace 10");
|
||||
#endif
|
||||
/* We try to find the best font in the Qt code */
|
||||
if (prefs.gui_qt_font_name) g_free(prefs.gui_qt_font_name);
|
||||
g_free(prefs.gui_qt_font_name);
|
||||
prefs.gui_qt_font_name = g_strdup("");
|
||||
prefs.gui_marked_fg.red = 65535;
|
||||
prefs.gui_marked_fg.green = 65535;
|
||||
|
@ -3980,9 +3980,9 @@ pre_init_prefs(void)
|
|||
prefs.gui_ignored_bg.red = 65535;
|
||||
prefs.gui_ignored_bg.green = 65535;
|
||||
prefs.gui_ignored_bg.blue = 65535;
|
||||
if (prefs.gui_colorized_fg) g_free(prefs.gui_colorized_fg);
|
||||
g_free(prefs.gui_colorized_fg);
|
||||
prefs.gui_colorized_fg = g_strdup("000000,000000,000000,000000,000000,000000,000000,000000,000000,000000");
|
||||
if (prefs.gui_colorized_bg) g_free(prefs.gui_colorized_bg);
|
||||
g_free(prefs.gui_colorized_bg);
|
||||
prefs.gui_colorized_bg = g_strdup("ffc0c0,ffc0ff,e0c0e0,c0c0ff,c0e0e0,c0ffff,c0ffc0,ffffc0,e0e0c0,e0e0e0");
|
||||
prefs.st_client_fg.red = 32767;
|
||||
prefs.st_client_fg.green = 0;
|
||||
|
@ -4029,7 +4029,7 @@ pre_init_prefs(void)
|
|||
prefs.gui_fileopen_style = FO_STYLE_LAST_OPENED;
|
||||
prefs.gui_recent_df_entries_max = 10;
|
||||
prefs.gui_recent_files_count_max = 10;
|
||||
if (prefs.gui_fileopen_dir) g_free(prefs.gui_fileopen_dir);
|
||||
g_free(prefs.gui_fileopen_dir);
|
||||
prefs.gui_fileopen_dir = g_strdup(get_persdatafile_dir());
|
||||
prefs.gui_fileopen_preview = 3;
|
||||
prefs.gui_ask_unsaved = TRUE;
|
||||
|
@ -4038,13 +4038,13 @@ pre_init_prefs(void)
|
|||
prefs.gui_update_enabled = TRUE;
|
||||
prefs.gui_update_channel = UPDATE_CHANNEL_STABLE;
|
||||
prefs.gui_update_interval = 60*60*24; /* Seconds */
|
||||
if (prefs.gui_webbrowser) g_free(prefs.gui_webbrowser);
|
||||
g_free(prefs.gui_webbrowser);
|
||||
prefs.gui_webbrowser = g_strdup("");
|
||||
if (prefs.gui_window_title) g_free(prefs.gui_window_title);
|
||||
g_free(prefs.gui_window_title);
|
||||
prefs.gui_window_title = g_strdup("");
|
||||
if (prefs.gui_prepend_window_title) g_free(prefs.gui_prepend_window_title);
|
||||
g_free(prefs.gui_prepend_window_title);
|
||||
prefs.gui_prepend_window_title = g_strdup("");
|
||||
if (prefs.gui_start_title) g_free(prefs.gui_start_title);
|
||||
g_free(prefs.gui_start_title);
|
||||
prefs.gui_start_title = g_strdup("The World's Most Popular Network Protocol Analyzer");
|
||||
prefs.gui_version_placement = version_both;
|
||||
prefs.gui_auto_scroll_on_expand = FALSE;
|
||||
|
@ -4057,7 +4057,7 @@ pre_init_prefs(void)
|
|||
prefs.gui_packet_list_elide_mode = ELIDE_RIGHT;
|
||||
prefs.gui_packet_list_show_related = TRUE;
|
||||
prefs.gui_packet_list_show_minimap = TRUE;
|
||||
if (prefs.gui_interfaces_hide_types) g_free (prefs.gui_interfaces_hide_types);
|
||||
g_free (prefs.gui_interfaces_hide_types);
|
||||
prefs.gui_interfaces_hide_types = g_strdup("");
|
||||
prefs.gui_interfaces_show_hidden = FALSE;
|
||||
#ifdef HAVE_PCAP_REMOTE
|
||||
|
|
|
@ -787,8 +787,7 @@ gboolean radius_load_dictionary (radius_dictionary_t* d, gchar* dir, const gchar
|
|||
*/
|
||||
|
||||
for (i = 0; i < MAX_INCLUDE_DEPTH; i++) {
|
||||
if (state.fullpaths[i])
|
||||
g_free(state.fullpaths[i]);
|
||||
g_free(state.fullpaths[i]);
|
||||
}
|
||||
|
||||
g_hash_table_foreach(state.dict->attrs_by_id,setup_attrs,&state);
|
||||
|
|
|
@ -130,9 +130,7 @@ static void
|
|||
fragment_addresses_free_temporary_key(gpointer ptr)
|
||||
{
|
||||
fragment_addresses_key *key = (fragment_addresses_key *)ptr;
|
||||
|
||||
if(key)
|
||||
g_slice_free(fragment_addresses_key, key);
|
||||
g_slice_free(fragment_addresses_key, key);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -268,9 +266,7 @@ static void
|
|||
fragment_addresses_ports_free_temporary_key(gpointer ptr)
|
||||
{
|
||||
fragment_addresses_ports_key *key = (fragment_addresses_ports_key *)ptr;
|
||||
|
||||
if(key)
|
||||
g_slice_free(fragment_addresses_ports_key, key);
|
||||
g_slice_free(fragment_addresses_ports_key, key);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -224,11 +224,7 @@ init_srt_table(const char *name, const char *short_name, GArray *srt_array, int
|
|||
int i;
|
||||
srt_stat_table *table = g_new(srt_stat_table, 1);
|
||||
|
||||
if(filter_string){
|
||||
table->filter_string=g_strdup(filter_string);
|
||||
} else {
|
||||
table->filter_string=NULL;
|
||||
}
|
||||
table->filter_string = g_strdup(filter_string);
|
||||
|
||||
table->name = name;
|
||||
table->short_name = short_name;
|
||||
|
|
|
@ -516,9 +516,7 @@ free_tap_listener(volatile tap_listener_t *tl)
|
|||
{
|
||||
if(!tl)
|
||||
return;
|
||||
if(tl->code){
|
||||
dfilter_free(tl->code);
|
||||
}
|
||||
dfilter_free(tl->code);
|
||||
g_free(tl->fstring);
|
||||
DIAG_OFF(cast-qual)
|
||||
g_free((gpointer)tl);
|
||||
|
|
|
@ -161,8 +161,7 @@ typedef struct {
|
|||
} TGrgx;
|
||||
|
||||
static void minfo_free(TGrgx* ud) {
|
||||
if (ud->match_info)
|
||||
g_match_info_free (ud->match_info);
|
||||
g_match_info_free (ud->match_info);
|
||||
ud->match_info = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -90,8 +90,7 @@ WSLUA_METAMETHOD CaptureInfo__tostring(lua_State* L) {
|
|||
|
||||
static int CaptureInfo__gc(lua_State* L) {
|
||||
CaptureInfo fc = toCaptureInfo(L,1);
|
||||
if (fc)
|
||||
g_free(fc);
|
||||
g_free(fc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -484,8 +483,7 @@ static int CaptureInfoConst_set_private_table(lua_State* L) {
|
|||
|
||||
static int CaptureInfoConst__gc(lua_State* L) {
|
||||
CaptureInfoConst fi = toCaptureInfoConst(L,1);
|
||||
if (fi)
|
||||
g_free(fi);
|
||||
g_free(fi);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ WSLUA_CONSTRUCTOR Dir_open(lua_State* L) {
|
|||
dir = (Dir)g_malloc(sizeof(struct _wslua_dir));
|
||||
dir->dir = g_dir_open(dirname_clean, 0, dir->dummy);
|
||||
g_free(dirname_clean);
|
||||
dir->ext = extension ? g_strdup(extension) : NULL;
|
||||
dir->ext = g_strdup(extension);
|
||||
dir->dummy = (GError **)g_malloc(sizeof(GError *));
|
||||
*(dir->dummy) = NULL;
|
||||
|
||||
|
@ -348,9 +348,7 @@ static int Dir__gc(lua_State* L) {
|
|||
}
|
||||
|
||||
g_free(dir->dummy);
|
||||
|
||||
if (dir->ext) g_free(dir->ext);
|
||||
|
||||
g_free(dir->ext);
|
||||
g_free(dir);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -474,8 +474,7 @@ WSLUA_METAMETHOD File__tostring(lua_State* L) {
|
|||
/* We free the struct we malloc'ed, but not the FILE_T/dumper in it of course */
|
||||
static int File__gc(lua_State* L) {
|
||||
File f = toFile(L,1);
|
||||
if (f)
|
||||
g_free(f);
|
||||
g_free(f);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -112,8 +112,7 @@ WSLUA_METHOD FrameInfo_read_data(lua_State* L) {
|
|||
/* free the struct we created, but not the phdr/buf it points to */
|
||||
static int FrameInfo__gc(lua_State* L) {
|
||||
FrameInfo fi = toFrameInfo(L,1);
|
||||
if (fi)
|
||||
g_free(fi);
|
||||
g_free(fi);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -322,8 +321,7 @@ WSLUA_METHOD FrameInfoConst_write_data(lua_State* L) {
|
|||
/* free the struct we created, but not the wtap_pkthdr it points to */
|
||||
static int FrameInfoConst__gc(lua_State* L) {
|
||||
FrameInfoConst fi = toFrameInfoConst(L,1);
|
||||
if (fi)
|
||||
g_free(fi);
|
||||
g_free(fi);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -216,7 +216,7 @@ WSLUA_CONSTRUCTOR Listener_new(lua_State* L) {
|
|||
tap = (Listener)g_malloc(sizeof(struct _wslua_tap));
|
||||
|
||||
tap->name = g_strdup(tap_type);
|
||||
tap->filter = filter ? g_strdup(filter) : NULL;
|
||||
tap->filter = g_strdup(filter);
|
||||
tap->extractor = wslua_get_tap_extractor(tap_type);
|
||||
tap->L = L;
|
||||
tap->packet_ref = LUA_NOREF;
|
||||
|
|
|
@ -177,8 +177,7 @@ static ssh_channel run_ssh_command(ssh_session sshs, const char* capture_command
|
|||
g_free(quoted_iface);
|
||||
g_free(quoted_filter);
|
||||
g_free(cmdline);
|
||||
if (count_str)
|
||||
g_free(count_str);
|
||||
g_free(count_str);
|
||||
|
||||
return channel;
|
||||
}
|
||||
|
|
|
@ -691,14 +691,10 @@ static iface_toolbar_control *extcap_parse_control_sentence(GList *control_items
|
|||
}
|
||||
|
||||
param_value = (gchar *)g_hash_table_lookup(s->param_list, ENUM_KEY(EXTCAP_PARAM_TOOLTIP));
|
||||
if (param_value != NULL) {
|
||||
control->tooltip = g_strdup(param_value);
|
||||
}
|
||||
control->tooltip = g_strdup(param_value);
|
||||
|
||||
param_value = (gchar *)g_hash_table_lookup(s->param_list, ENUM_KEY(EXTCAP_PARAM_PLACEHOLDER));
|
||||
if (param_value != NULL) {
|
||||
control->placeholder = g_strdup(param_value);
|
||||
}
|
||||
control->placeholder = g_strdup(param_value);
|
||||
|
||||
param_value = (gchar *)g_hash_table_lookup(s->param_list, ENUM_KEY(EXTCAP_PARAM_TYPE));
|
||||
if (param_value == NULL) {
|
||||
|
|
12
file.c
12
file.c
|
@ -681,9 +681,7 @@ cf_read(capture_file *cf, gboolean reloading)
|
|||
g_free(name_ptr);
|
||||
|
||||
/* Cleanup and release all dfilter resources */
|
||||
if (dfcode != NULL) {
|
||||
dfilter_free(dfcode);
|
||||
}
|
||||
dfilter_free(dfcode);
|
||||
|
||||
epan_dissect_cleanup(&edt);
|
||||
|
||||
|
@ -849,9 +847,7 @@ cf_continue_tail(capture_file *cf, volatile int to_read, int *err)
|
|||
cf->lnk_t = wtap_file_encap(cf->wth);
|
||||
|
||||
/* Cleanup and release all dfilter resources */
|
||||
if (dfcode != NULL) {
|
||||
dfilter_free(dfcode);
|
||||
}
|
||||
dfilter_free(dfcode);
|
||||
|
||||
epan_dissect_cleanup(&edt);
|
||||
|
||||
|
@ -963,9 +959,7 @@ cf_finish_tail(capture_file *cf, int *err)
|
|||
}
|
||||
|
||||
/* Cleanup and release all dfilter resources */
|
||||
if (dfcode != NULL) {
|
||||
dfilter_free(dfcode);
|
||||
}
|
||||
dfilter_free(dfcode);
|
||||
|
||||
epan_dissect_cleanup(&edt);
|
||||
|
||||
|
|
|
@ -187,7 +187,7 @@ static gchar* recolonize(mate_config* mc, gchar* s) {
|
|||
%token_type { gchar* }
|
||||
%token_destructor {
|
||||
(void) mc; /* Mark unused, similar to Q_UNUSED */
|
||||
if ($$) g_free($$);
|
||||
g_free($$);
|
||||
}
|
||||
|
||||
%extra_argument { mate_config* mc }
|
||||
|
|
|
@ -3047,7 +3047,7 @@ PRIVATE FILE *file_open(
|
|||
){
|
||||
FILE *fp;
|
||||
|
||||
if( lemp->outname ) free(lemp->outname);
|
||||
free(lemp->outname);
|
||||
lemp->outname = file_makename_using_basename(lemp, suffix);
|
||||
fp = fopen(lemp->outname,mode);
|
||||
if( fp==0 && *mode=='w' ){
|
||||
|
@ -3459,9 +3459,8 @@ PRIVATE FILE *tplt_open(struct lemon *lemp)
|
|||
fprintf(stderr,"Can't open the template file \"%s\".\n",templatename);
|
||||
lemp->errorcnt++;
|
||||
}
|
||||
if (tpltname_alloc) {
|
||||
free(tpltname_alloc);
|
||||
}
|
||||
free(tpltname_alloc);
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
|
|
|
@ -565,11 +565,7 @@ comparestat_init(const char *opt_arg, void *userdata _U_)
|
|||
cs->zebra_time.nsecs = 1;
|
||||
cs->nr_set = g_hash_table_new(NULL, NULL);
|
||||
|
||||
if (filter) {
|
||||
cs->filter = g_strdup(filter);
|
||||
} else {
|
||||
cs->filter = NULL;
|
||||
}
|
||||
cs->filter = g_strdup(filter);
|
||||
|
||||
/* create a Hash to count the packets with the same ip.id */
|
||||
cs->packet_set = g_hash_table_new_full(NULL, NULL, NULL, frame_info_free);
|
||||
|
|
|
@ -293,11 +293,7 @@ httpstat_init(const char *opt_arg, void *userdata _U_)
|
|||
}
|
||||
|
||||
sp = g_new(httpstat_t, 1);
|
||||
if (filter) {
|
||||
sp->filter = g_strdup(filter);
|
||||
} else {
|
||||
sp->filter = NULL;
|
||||
}
|
||||
sp->filter = g_strdup(filter);
|
||||
/*g_hash_table_foreach(http_status, (GHFunc)http_reset_hash_responses, NULL);*/
|
||||
|
||||
|
||||
|
|
|
@ -283,8 +283,7 @@ icmpstat_init(const char *opt_arg, void *userdata _U_)
|
|||
memset(icmpstat, 0, sizeof(icmpstat_t));
|
||||
icmpstat->min_msecs = 1.0 * G_MAXUINT;
|
||||
|
||||
if (filter)
|
||||
icmpstat->filter = g_strdup(filter);
|
||||
icmpstat->filter = g_strdup(filter);
|
||||
|
||||
/* It is possible to create a filter and attach it to the callbacks. Then the
|
||||
* callbacks would only be invoked if the filter matched.
|
||||
|
@ -300,8 +299,7 @@ icmpstat_init(const char *opt_arg, void *userdata _U_)
|
|||
TL_REQUIRES_NOTHING, icmpstat_reset, icmpstat_packet, icmpstat_draw);
|
||||
if (error_string) {
|
||||
/* error, we failed to attach to the tap. clean up */
|
||||
if (icmpstat->filter)
|
||||
g_free(icmpstat->filter);
|
||||
g_free(icmpstat->filter);
|
||||
g_free(icmpstat);
|
||||
|
||||
fprintf(stderr, "tshark: Couldn't register icmp,srt tap: %s\n",
|
||||
|
|
|
@ -284,8 +284,7 @@ icmpv6stat_init(const char *opt_arg, void *userdata _U_)
|
|||
memset(icmpv6stat, 0, sizeof(icmpv6stat_t));
|
||||
icmpv6stat->min_msecs = 1.0 * G_MAXUINT;
|
||||
|
||||
if (filter)
|
||||
icmpv6stat->filter = g_strdup(filter);
|
||||
icmpv6stat->filter = g_strdup(filter);
|
||||
|
||||
/* It is possible to create a filter and attach it to the callbacks. Then the
|
||||
* callbacks would only be invoked if the filter matched.
|
||||
|
@ -301,8 +300,7 @@ icmpv6stat_init(const char *opt_arg, void *userdata _U_)
|
|||
TL_REQUIRES_NOTHING, icmpv6stat_reset, icmpv6stat_packet, icmpv6stat_draw);
|
||||
if (error_string) {
|
||||
/* error, we failed to attach to the tap. clean up */
|
||||
if (icmpv6stat->filter)
|
||||
g_free(icmpv6stat->filter);
|
||||
g_free(icmpv6stat->filter);
|
||||
g_free(icmpv6stat);
|
||||
|
||||
fprintf(stderr, "tshark: Couldn't register icmpv6,srt tap: %s\n",
|
||||
|
|
|
@ -1202,8 +1202,7 @@ iostat_draw(void *arg)
|
|||
}
|
||||
|
||||
if (last_row) {
|
||||
if (fmt)
|
||||
g_free(fmt);
|
||||
g_free(fmt);
|
||||
} else {
|
||||
item_in_column[j] = item_in_column[j]->next;
|
||||
}
|
||||
|
|
|
@ -184,12 +184,7 @@ protohierstat_init(const char *opt_arg, void *userdata _U_)
|
|||
}
|
||||
|
||||
rs = new_phs_t(NULL);
|
||||
|
||||
if (filter) {
|
||||
rs->filter = g_strdup(filter);
|
||||
} else {
|
||||
rs->filter = NULL;
|
||||
}
|
||||
rs->filter = g_strdup(filter);
|
||||
|
||||
error_string = register_tap_listener("frame", rs, filter, TL_REQUIRES_PROTO_TREE, NULL, protohierstat_packet, protohierstat_draw);
|
||||
if (error_string) {
|
||||
|
|
|
@ -245,11 +245,7 @@ rtspstat_init(const char *opt_arg, void *userdata _U_)
|
|||
}
|
||||
|
||||
sp = (rtspstat_t *)g_malloc( sizeof(rtspstat_t) );
|
||||
if (filter) {
|
||||
sp->filter = g_strdup(filter);
|
||||
} else {
|
||||
sp->filter = NULL;
|
||||
}
|
||||
sp->filter = g_strdup(filter);
|
||||
/*g_hash_table_foreach( rtsp_status, (GHFunc)rtsp_reset_hash_responses, NULL);*/
|
||||
|
||||
|
||||
|
|
|
@ -422,11 +422,7 @@ sipstat_init(const char *opt_arg, void *userdata _U_)
|
|||
}
|
||||
|
||||
sp = g_new0(sipstat_t, 1);
|
||||
if (filter) {
|
||||
sp->filter = g_strdup(filter);
|
||||
} else {
|
||||
sp->filter = NULL;
|
||||
}
|
||||
sp->filter = g_strdup(filter);
|
||||
/*g_hash_table_foreach( sip_status, (GHFunc)sip_reset_hash_responses, NULL);*/
|
||||
|
||||
|
||||
|
|
|
@ -245,11 +245,8 @@ wspstat_init(const char *opt_arg, void *userdata _U_)
|
|||
}
|
||||
sp->num_pdus = 16;
|
||||
sp->pdu_stats = g_new(wsp_pdu_t, (sp->num_pdus+1));
|
||||
if (filter) {
|
||||
sp->filter = g_strdup(filter);
|
||||
} else {
|
||||
sp->filter = NULL;
|
||||
}
|
||||
sp->filter = g_strdup(filter);
|
||||
|
||||
for (i=0; i<sp->num_pdus; i++)
|
||||
{
|
||||
sp->pdu_stats[i].packets = 0;
|
||||
|
|
|
@ -510,8 +510,7 @@ write_wlan_driver_wep_keys_to_registry(GList* key_list)
|
|||
/*
|
||||
* Free the old adapter key collection!
|
||||
*/
|
||||
if (fake_info_if->keysCollection != NULL)
|
||||
g_free(fake_info_if->keysCollection);
|
||||
g_free(fake_info_if->keysCollection);
|
||||
|
||||
/*
|
||||
* Set this collection ad the new one
|
||||
|
@ -647,8 +646,7 @@ write_wlan_wep_keys_to_registry(airpcap_if_info_t* info_if, GList* key_list)
|
|||
/*
|
||||
* Free the old adapter key collection!
|
||||
*/
|
||||
if (info_if->keysCollection != NULL)
|
||||
g_free(info_if->keysCollection);
|
||||
g_free(info_if->keysCollection);
|
||||
|
||||
/*
|
||||
* Set this collection ad the new one
|
||||
|
@ -1028,7 +1026,7 @@ get_airpcap_driver_keys(void)
|
|||
/* KEY */
|
||||
tmp_key = airpcap_get_key_string(fake_info_if->keysCollection->Keys[i]);
|
||||
new_key->key = g_string_new(tmp_key);
|
||||
if (tmp_key != NULL) g_free(tmp_key);
|
||||
g_free(tmp_key);
|
||||
|
||||
/* BITS */
|
||||
new_key->bits = (guint) new_key->key->len *4; /* every char is 4 bits in WEP keys (it is an hexadecimal number) */
|
||||
|
@ -1243,7 +1241,7 @@ free_key_list(GList *list)
|
|||
g_string_free(curr_key->key, TRUE);
|
||||
|
||||
if (curr_key->ssid != NULL)
|
||||
g_byte_array_free(curr_key->ssid, TRUE);
|
||||
g_byte_array_free(curr_key->ssid, TRUE);
|
||||
|
||||
/* free the decryption_key_t structure*/
|
||||
g_free(curr_key);
|
||||
|
@ -2077,8 +2075,7 @@ airpcap_add_keys_to_driver_from_list(GtkListStore *key_list_store, airpcap_if_in
|
|||
/*
|
||||
* Free the old adapter key collection!
|
||||
*/
|
||||
if (fake_if_info->keysCollection != NULL)
|
||||
g_free(fake_if_info->keysCollection);
|
||||
g_free(fake_if_info->keysCollection);
|
||||
|
||||
/*
|
||||
* Set this collection ad the new one
|
||||
|
|
|
@ -2480,8 +2480,7 @@ save_options_cb(GtkWidget *win _U_, gpointer user_data _U_)
|
|||
device.snaplen = WTAP_MAX_PACKET_SIZE_STANDARD;
|
||||
}
|
||||
filter_text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(filter_cm));
|
||||
if (device.cfilter)
|
||||
g_free(device.cfilter);
|
||||
g_free(device.cfilter);
|
||||
g_assert(filter_text != NULL);
|
||||
device.cfilter = filter_text;
|
||||
|
||||
|
@ -4523,9 +4522,7 @@ update_properties_all(void)
|
|||
if (strcmp(device.cfilter, filter_str) != 0) {
|
||||
/* No, so not all selected interfaces have the same capture
|
||||
filter. */
|
||||
if (filter_str != NULL) {
|
||||
g_free(filter_str);
|
||||
}
|
||||
g_free(filter_str);
|
||||
filter_str = NULL;
|
||||
filter_all = FALSE;
|
||||
}
|
||||
|
@ -5445,11 +5442,8 @@ capture_start_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
the same as the one the other interfaces we've looked
|
||||
at have? */
|
||||
if (strcmp(interface_opts.cfilter, filter_str) != 0) {
|
||||
/* No, so not all selected interfaces have the same capture
|
||||
filter. */
|
||||
if (filter_str != NULL) {
|
||||
g_free(filter_str);
|
||||
}
|
||||
/* No, so not all selected interfaces have the same capture filter. */
|
||||
g_free(filter_str);
|
||||
filter_str = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -930,8 +930,7 @@ file_merge_cmd(GtkWidget *w _U_)
|
|||
}
|
||||
|
||||
if (merge_status != CF_OK) {
|
||||
if (rfcode != NULL)
|
||||
dfilter_free(rfcode);
|
||||
dfilter_free(rfcode);
|
||||
g_free(tmpname);
|
||||
continue;
|
||||
}
|
||||
|
@ -941,8 +940,7 @@ file_merge_cmd(GtkWidget *w _U_)
|
|||
/* Try to open the merged capture file. This closes the current file if it succeeds. */
|
||||
if (cf_open(&cfile, tmpname, WTAP_TYPE_AUTO, TRUE /* temporary file */, &err) != CF_OK) {
|
||||
/* We couldn't open it; fail. */
|
||||
if (rfcode != NULL)
|
||||
dfilter_free(rfcode);
|
||||
dfilter_free(rfcode);
|
||||
g_free(tmpname);
|
||||
g_string_free(file_name, TRUE);
|
||||
g_string_free(display_filter, TRUE);
|
||||
|
|
|
@ -448,9 +448,7 @@ color_edit_dlg_ok_cb(GtkWidget *w _U_, gpointer user_data)
|
|||
1, filter_text, 2, fg_str, 3, bg_str,
|
||||
4, filter_disabled, -1);
|
||||
|
||||
if (colorf->c_colorfilter != NULL) {
|
||||
dfilter_free(colorf->c_colorfilter);
|
||||
}
|
||||
dfilter_free(colorf->c_colorfilter);
|
||||
colorf->c_colorfilter = compiled_filter;
|
||||
|
||||
/* Destroy the dialog box. */
|
||||
|
|
|
@ -741,8 +741,7 @@ GtkWidget *extcap_create_gtk_multicheckwidget(extcap_arg *argument,
|
|||
EXTCAP_GTK_MULTI_COL_ACTIVATABLE, v->enabled, -1);
|
||||
}
|
||||
|
||||
if (prev_list != NULL)
|
||||
g_strfreev(prev_list);
|
||||
g_strfreev(prev_list);
|
||||
|
||||
renderer = gtk_cell_renderer_text_new();
|
||||
togglerenderer = gtk_cell_renderer_toggle_new();
|
||||
|
@ -866,8 +865,7 @@ GSList *extcap_populate_gtk_vbox(GList *arguments, GtkWidget *vbox,
|
|||
|
||||
gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.1f);
|
||||
item = extcap_create_gtk_fileselect(arg_iter, prev_map, default_str);
|
||||
if (default_str != NULL)
|
||||
g_free(default_str);
|
||||
g_free(default_str);
|
||||
break;
|
||||
case EXTCAP_ARG_TIMESTAMP:
|
||||
default_str = NULL;
|
||||
|
|
|
@ -516,7 +516,7 @@ static gboolean funnel_open_file(funnel_ops_id_t *ops_id _U_, const char* fname,
|
|||
/* This closes the current file if it succeeds. */
|
||||
if (cf_open(&cfile, fname, WTAP_TYPE_AUTO, FALSE, &err) != CF_OK) {
|
||||
*err_str = g_strdup(g_strerror(err));
|
||||
if (rfcode != NULL) dfilter_free(rfcode);
|
||||
dfilter_free(rfcode);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1826,8 +1826,7 @@ filter_callback(GtkWidget *widget, gpointer user_data)
|
|||
io_stat_redraw(gio->io);
|
||||
return;
|
||||
}
|
||||
if (dfilter != NULL)
|
||||
dfilter_free(dfilter);
|
||||
dfilter_free(dfilter);
|
||||
|
||||
/* ok, we have a valid filter and the graph is active.
|
||||
first just try to delete any previous settings and then apply
|
||||
|
|
|
@ -1052,12 +1052,7 @@ static void gtk_mac_lte_stat_init(const char *opt_arg, void *userdata _U_)
|
|||
hs->ep_list = NULL;
|
||||
|
||||
/* Copy filter (so can be used for window title at reset) */
|
||||
if (filter) {
|
||||
hs->filter = g_strdup(filter);
|
||||
}
|
||||
else {
|
||||
hs->filter = NULL;
|
||||
}
|
||||
hs->filter = g_strdup(filter);
|
||||
|
||||
/* Set title */
|
||||
display_name = cf_get_display_name(&cfile);
|
||||
|
|
|
@ -2584,8 +2584,7 @@ main(int argc, char *argv[])
|
|||
g_free(global_commandline_info.cf_name);
|
||||
global_commandline_info.cf_name = NULL;
|
||||
} else {
|
||||
if (rfcode != NULL)
|
||||
dfilter_free(rfcode);
|
||||
dfilter_free(rfcode);
|
||||
cfile.rfcode = NULL;
|
||||
show_main_window(FALSE);
|
||||
/* Don't call check_and_warn_user_startup(): we did it above */
|
||||
|
|
|
@ -1123,8 +1123,7 @@ fill_capture_box(void)
|
|||
label_text = g_strdup_printf("Error = %d; this \"can't happen\".", error);
|
||||
break;
|
||||
}
|
||||
if (err_str != NULL)
|
||||
g_free(err_str);
|
||||
g_free(err_str);
|
||||
w = gtk_label_new(label_text);
|
||||
gtk_label_set_markup(GTK_LABEL(w), label_text);
|
||||
gtk_label_set_line_wrap(GTK_LABEL(w), TRUE);
|
||||
|
|
|
@ -273,10 +273,6 @@ capture_prefs_fetch(GtkWidget *w)
|
|||
auto_scroll_cb = (GtkWidget *)g_object_get_data(G_OBJECT(w), AUTO_SCROLL_KEY);
|
||||
show_info_cb = (GtkWidget *)g_object_get_data(G_OBJECT(w), SHOW_INFO_KEY);
|
||||
|
||||
if (prefs.capture_device != NULL) {
|
||||
g_free(prefs.capture_device);
|
||||
prefs.capture_device = NULL;
|
||||
}
|
||||
if_text = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(if_cbxe)))));
|
||||
/* Strip out white space */
|
||||
g_strstrip(if_text);
|
||||
|
@ -291,6 +287,8 @@ capture_prefs_fetch(GtkWidget *w)
|
|||
/* Ensure capture device is not NULL */
|
||||
if (if_text == NULL)
|
||||
if_text = g_strdup("");
|
||||
|
||||
g_free(prefs.capture_device);
|
||||
prefs.capture_device = if_text;
|
||||
|
||||
prefs.capture_prom_mode = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(promisc_cb));
|
||||
|
|
|
@ -1308,13 +1308,7 @@ static void gtk_rlc_lte_stat_init(const char *opt_arg, void *userdata _U_)
|
|||
hs->ep_list = NULL;
|
||||
|
||||
/* Copy filter (so can be used for window title at reset) */
|
||||
if (filter) {
|
||||
hs->filter = g_strdup(filter);
|
||||
}
|
||||
else {
|
||||
hs->filter = NULL;
|
||||
}
|
||||
|
||||
hs->filter = g_strdup(filter);
|
||||
|
||||
/* Set title */
|
||||
display_name = cf_get_display_name(&cfile);
|
||||
|
|
|
@ -176,11 +176,7 @@ scan_local_interfaces(void (*update_cb)(void))
|
|||
continue;
|
||||
}
|
||||
device.name = g_strdup(if_info->name);
|
||||
if (if_info->friendly_name != NULL) {
|
||||
device.friendly_name = g_strdup(if_info->friendly_name);
|
||||
} else {
|
||||
device.friendly_name = NULL;
|
||||
}
|
||||
device.friendly_name = g_strdup(if_info->friendly_name);
|
||||
device.hidden = FALSE;
|
||||
memset(&temp, 0, sizeof(temp));
|
||||
temp.name = g_strdup(if_info->name);
|
||||
|
|
|
@ -46,8 +46,7 @@ read_language_pref(gchar *key, const gchar *value,
|
|||
void *private_data _U_, gboolean return_range_errors _U_)
|
||||
{
|
||||
if (strcmp(key, LANGUAGE_PREF_LANGUAGE) == 0) {
|
||||
if (language)
|
||||
g_free(language);
|
||||
g_free(language);
|
||||
/*
|
||||
* For backwards compatibility, treat "auto" as meaning "use the
|
||||
* system language".
|
||||
|
|
|
@ -345,10 +345,7 @@ static gboolean
|
|||
stat_node_free(GNode *node, gpointer data _U_)
|
||||
{
|
||||
ph_stats_node_t *stats = (ph_stats_node_t *)node->data;
|
||||
|
||||
if (stats) {
|
||||
g_free(stats);
|
||||
}
|
||||
g_free(stats);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1276,8 +1276,7 @@ void MainWindow::mergeCaptureFile()
|
|||
g_free(in_filenames[1]);
|
||||
|
||||
if (merge_status != CF_OK) {
|
||||
if (rfcode != NULL)
|
||||
dfilter_free(rfcode);
|
||||
dfilter_free(rfcode);
|
||||
g_free(tmpname);
|
||||
continue;
|
||||
}
|
||||
|
@ -1289,8 +1288,7 @@ void MainWindow::mergeCaptureFile()
|
|||
if (cf_open(CaptureFile::globalCapFile(), tmpname, WTAP_TYPE_AUTO, TRUE /* temporary file */, &err) != CF_OK) {
|
||||
/* We couldn't open it; fail. */
|
||||
CaptureFile::globalCapFile()->window = NULL;
|
||||
if (rfcode != NULL)
|
||||
dfilter_free(rfcode);
|
||||
dfilter_free(rfcode);
|
||||
g_free(tmpname);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -226,8 +226,7 @@ void MainWindowPreferencesFrame::on_mainToolbarComboBox_currentIndexChanged(int
|
|||
|
||||
void MainWindowPreferencesFrame::on_languageComboBox_currentIndexChanged(int index)
|
||||
{
|
||||
if (language)
|
||||
g_free(language);
|
||||
g_free(language);
|
||||
|
||||
language = g_strdup(ui->languageComboBox->itemData(index).toString().toStdString().c_str());
|
||||
}
|
||||
|
|
|
@ -250,8 +250,7 @@ bool MainWindow::openCaptureFile(QString cf_path, QString read_filter, unsigned
|
|||
dismiss the alert box popped up for the open error,
|
||||
try again. */
|
||||
CaptureFile::globalCapFile()->window = NULL;
|
||||
if (rfcode != NULL)
|
||||
dfilter_free(rfcode);
|
||||
dfilter_free(rfcode);
|
||||
cf_path.clear();
|
||||
continue;
|
||||
}
|
||||
|
|
16
ui/recent.c
16
ui/recent.c
|
@ -1123,9 +1123,7 @@ read_set_recent_pair_static(gchar *key, const gchar *value,
|
|||
}
|
||||
prefs_clear_string_list(col_l);
|
||||
} else if (strcmp(key, RECENT_GUI_FILEOPEN_REMEMBERED_DIR) == 0) {
|
||||
if (recent.gui_fileopen_remembered_dir) {
|
||||
g_free (recent.gui_fileopen_remembered_dir);
|
||||
}
|
||||
g_free(recent.gui_fileopen_remembered_dir);
|
||||
recent.gui_fileopen_remembered_dir = g_strdup(value);
|
||||
} else if (strcmp(key, RECENT_GUI_TOOLBAR_SHOW) == 0) {
|
||||
recent.gui_additional_toolbars = prefs_get_string_list(value);
|
||||
|
@ -1446,11 +1444,7 @@ recent_set_column_width(gint col, gint width)
|
|||
if (!found) {
|
||||
col_w = (col_width_data *) g_malloc(sizeof(col_width_data));
|
||||
col_w->cfmt = cfmt;
|
||||
if (cfield) {
|
||||
col_w->cfield = g_strdup(cfield);
|
||||
} else {
|
||||
col_w->cfield = NULL;
|
||||
}
|
||||
col_w->cfield = g_strdup(cfield);
|
||||
col_w->width = width;
|
||||
col_w->xalign = COLUMN_XALIGN_DEFAULT;
|
||||
recent.col_width_list = g_list_append(recent.col_width_list, col_w);
|
||||
|
@ -1514,11 +1508,7 @@ recent_set_column_xalign(gint col, gchar xalign)
|
|||
if (!found) {
|
||||
col_w = (col_width_data *) g_malloc(sizeof(col_width_data));
|
||||
col_w->cfmt = cfmt;
|
||||
if (cfield) {
|
||||
col_w->cfield = g_strdup(cfield);
|
||||
} else {
|
||||
col_w->cfield = NULL;
|
||||
}
|
||||
col_w->cfield = g_strdup(cfield);
|
||||
col_w->width = 40;
|
||||
col_w->xalign = xalign;
|
||||
recent.col_width_list = g_list_append(recent.col_width_list, col_w);
|
||||
|
|
|
@ -1377,25 +1377,21 @@ isup_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt,
|
|||
callsinfo->call_active_state = VOIP_ACTIVE;
|
||||
callsinfo->call_state = VOIP_UNKNOWN;
|
||||
copy_address(&(callsinfo->initial_speaker),&(pinfo->src));
|
||||
callsinfo->selected=FALSE;
|
||||
callsinfo->start_fd=pinfo->fd;
|
||||
callsinfo->start_rel_ts=pinfo->rel_ts;
|
||||
callsinfo->protocol=VOIP_ISUP;
|
||||
if (pi->calling_number!=NULL) {
|
||||
callsinfo->from_identity=g_strdup(pi->calling_number);
|
||||
}
|
||||
if (pi->called_number!=NULL) {
|
||||
callsinfo->to_identity=g_strdup(pi->called_number);
|
||||
}
|
||||
callsinfo->prot_info=g_malloc(sizeof(isup_calls_info_t));
|
||||
callsinfo->selected = FALSE;
|
||||
callsinfo->start_fd = pinfo->fd;
|
||||
callsinfo->start_rel_ts = pinfo->rel_ts;
|
||||
callsinfo->protocol = VOIP_ISUP;
|
||||
callsinfo->from_identity = g_strdup(pi->calling_number);
|
||||
callsinfo->to_identity = g_strdup(pi->called_number);
|
||||
callsinfo->prot_info = g_malloc(sizeof(isup_calls_info_t));
|
||||
callsinfo->free_prot_info = g_free;
|
||||
tmp_isupinfo=(isup_calls_info_t *)callsinfo->prot_info;
|
||||
tmp_isupinfo->opc = tapinfo->mtp3_opc;
|
||||
tmp_isupinfo->dpc = tapinfo->mtp3_dpc;
|
||||
tmp_isupinfo->ni = tapinfo->mtp3_ni;
|
||||
tmp_isupinfo->cic = pi->circuit_id;
|
||||
callsinfo->npackets = 0;
|
||||
callsinfo->call_num = tapinfo->ncalls++;
|
||||
tmp_isupinfo = (isup_calls_info_t *)callsinfo->prot_info;
|
||||
tmp_isupinfo->opc = tapinfo->mtp3_opc;
|
||||
tmp_isupinfo->dpc = tapinfo->mtp3_dpc;
|
||||
tmp_isupinfo->ni = tapinfo->mtp3_ni;
|
||||
tmp_isupinfo->cic = pi->circuit_id;
|
||||
callsinfo->npackets = 0;
|
||||
callsinfo->call_num = tapinfo->ncalls++;
|
||||
g_queue_push_tail(tapinfo->callsinfos, callsinfo);
|
||||
}
|
||||
|
||||
|
|
|
@ -1323,8 +1323,7 @@ filter_tb_syntax_check(HWND hwnd, TCHAR *filter_text) {
|
|||
SendMessage(hwnd, EM_SETBKGNDCOLOR, (WPARAM) 1, COLOR_WINDOW);
|
||||
return;
|
||||
} else if (dfilter_compile(utf_16to8(strval), &dfp, NULL)) { /* colorize filter string entry */
|
||||
if (dfp != NULL)
|
||||
dfilter_free(dfp);
|
||||
dfilter_free(dfp);
|
||||
/* Valid (light green) */
|
||||
SendMessage(hwnd, EM_SETBKGNDCOLOR, 0, RGB(0xe4, 0xff, 0xc7)); /* tango_chameleon_1 */
|
||||
} else {
|
||||
|
@ -1332,7 +1331,7 @@ filter_tb_syntax_check(HWND hwnd, TCHAR *filter_text) {
|
|||
SendMessage(hwnd, EM_SETBKGNDCOLOR, 0, RGB(0xff, 0xcc, 0xcc)); /* tango_scarlet_red_1 */
|
||||
}
|
||||
|
||||
if (strval) g_free(strval);
|
||||
g_free(strval);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1365,8 +1364,7 @@ open_file_hook_proc(HWND of_hwnd, UINT msg, WPARAM w_param, LPARAM l_param) {
|
|||
case CDN_FILEOK:
|
||||
/* Fetch the read filter */
|
||||
cur_ctrl = GetDlgItem(of_hwnd, EWFD_FILTER_EDIT);
|
||||
if (g_dfilter_str)
|
||||
g_free(g_dfilter_str);
|
||||
g_free(g_dfilter_str);
|
||||
g_dfilter_str = filter_tb_get(cur_ctrl);
|
||||
|
||||
cur_ctrl = GetDlgItem(of_hwnd, EWFD_FORMAT_TYPE);
|
||||
|
@ -2220,8 +2218,7 @@ merge_file_hook_proc(HWND mf_hwnd, UINT msg, WPARAM w_param, LPARAM l_param) {
|
|||
case CDN_FILEOK:
|
||||
/* Fetch the read filter */
|
||||
cur_ctrl = GetDlgItem(mf_hwnd, EWFD_FILTER_EDIT);
|
||||
if (g_dfilter_str)
|
||||
g_free(g_dfilter_str);
|
||||
g_free(g_dfilter_str);
|
||||
g_dfilter_str = filter_tb_get(cur_ctrl);
|
||||
|
||||
cur_ctrl = GetDlgItem(mf_hwnd, EWFD_MERGE_CHRONO_BTN);
|
||||
|
|
|
@ -1670,9 +1670,7 @@ free_line_prefix_info(gpointer key, gpointer value,
|
|||
|
||||
/* Free the strings inside */
|
||||
g_free(info->before_time);
|
||||
if (info->after_time) {
|
||||
g_free(info->after_time);
|
||||
}
|
||||
g_free(info->after_time);
|
||||
|
||||
/* And the structure itself */
|
||||
g_free(info);
|
||||
|
|
|
@ -523,8 +523,7 @@ wtap_deregister_open_info(const gchar *name)
|
|||
|
||||
for (i = 0; i < open_info_arr->len; i++) {
|
||||
if (open_routines[i].name && strcmp(open_routines[i].name, name) == 0) {
|
||||
if (open_routines[i].extensions_set != NULL)
|
||||
g_strfreev(open_routines[i].extensions_set);
|
||||
g_strfreev(open_routines[i].extensions_set);
|
||||
open_info_arr = g_array_remove_index(open_info_arr, i);
|
||||
set_heuristic_routine();
|
||||
return;
|
||||
|
@ -2590,8 +2589,7 @@ wtap_dump_close(wtap_dumper *wdh, int *err)
|
|||
}
|
||||
ret = FALSE;
|
||||
}
|
||||
if (wdh->priv != NULL)
|
||||
g_free(wdh->priv);
|
||||
g_free(wdh->priv);
|
||||
wtap_block_array_free(wdh->interface_data);
|
||||
g_free(wdh);
|
||||
return ret;
|
||||
|
|
|
@ -1938,12 +1938,9 @@ ngsniffer_close(wtap *wth)
|
|||
ngsniffer_t *ngsniffer;
|
||||
|
||||
ngsniffer = (ngsniffer_t *)wth->priv;
|
||||
if (ngsniffer->rand.buf != NULL)
|
||||
g_free(ngsniffer->rand.buf);
|
||||
if (ngsniffer->first_blob != NULL) {
|
||||
g_list_foreach(ngsniffer->first_blob, free_blob, NULL);
|
||||
g_list_free(ngsniffer->first_blob);
|
||||
}
|
||||
g_free(ngsniffer->rand.buf);
|
||||
g_list_foreach(ngsniffer->first_blob, free_blob, NULL);
|
||||
g_list_free(ngsniffer->first_blob);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -354,8 +354,7 @@ pppdump_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
|
|||
|
||||
if (!collate(state, wth->fh, err, err_info, buf, &num_bytes, &direction,
|
||||
pid, 0)) {
|
||||
if (pid != NULL)
|
||||
g_free(pid);
|
||||
g_free(pid);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -852,8 +852,7 @@ static void visual_dump_free(wtap_dumper *wdh)
|
|||
if (visual)
|
||||
{
|
||||
/* Free the index table memory. */
|
||||
if (visual->index_table)
|
||||
g_free(visual->index_table);
|
||||
g_free(visual->index_table);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1236,8 +1236,7 @@ wtap_close(wtap *wth)
|
|||
if (wth->random_fh != NULL)
|
||||
file_close(wth->random_fh);
|
||||
|
||||
if (wth->priv != NULL)
|
||||
g_free(wth->priv);
|
||||
g_free(wth->priv);
|
||||
|
||||
if (wth->fast_seek != NULL) {
|
||||
g_ptr_array_foreach(wth->fast_seek, g_fast_seek_item_free, NULL);
|
||||
|
|
|
@ -154,8 +154,7 @@ static GSList* local_interfaces_to_list_win(void)
|
|||
pCurrAddresses = pCurrAddresses->Next;
|
||||
}
|
||||
end:
|
||||
if (pAddresses)
|
||||
g_free(pAddresses);
|
||||
g_free(pAddresses);
|
||||
|
||||
return interfaces;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue