diff options
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-dcerpc.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-gsm_sms.c | 3 | ||||
-rw-r--r-- | epan/dissectors/packet-ieee80211.c | 13 | ||||
-rw-r--r-- | epan/dissectors/packet-k12.c | 10 | ||||
-rw-r--r-- | epan/dissectors/packet-kerberos.c | 10 | ||||
-rw-r--r-- | epan/dissectors/packet-multipart.c | 9 | ||||
-rw-r--r-- | epan/dissectors/packet-rtps.c | 5 | ||||
-rw-r--r-- | epan/dissectors/packet-rtps2.c | 5 | ||||
-rw-r--r-- | epan/dissectors/packet-snmp.c | 12 | ||||
-rw-r--r-- | epan/dissectors/packet-ssl-utils.c | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-user_encap.c | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-xml.c | 19 |
12 files changed, 41 insertions, 61 deletions
diff --git a/epan/dissectors/packet-dcerpc.c b/epan/dissectors/packet-dcerpc.c index 3c43b37719..6fee1c1d06 100644 --- a/epan/dissectors/packet-dcerpc.c +++ b/epan/dissectors/packet-dcerpc.c @@ -1679,9 +1679,7 @@ init_ndr_pointer_list(packet_info *pinfo) npd=g_slist_nth_data(ndr_pointer_list, 0); ndr_pointer_list=g_slist_remove(ndr_pointer_list, npd); - if(npd){ - g_free(npd); - } + g_free(npd); } ndr_pointer_list=NULL; diff --git a/epan/dissectors/packet-gsm_sms.c b/epan/dissectors/packet-gsm_sms.c index cad7db2ca0..1521ee7d15 100644 --- a/epan/dissectors/packet-gsm_sms.c +++ b/epan/dissectors/packet-gsm_sms.c @@ -2747,8 +2747,7 @@ dis_field_ud(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint32 length, gb } } - if(utf8_text) - g_free(utf8_text); + g_free(utf8_text); g_iconv_close(cd); } else diff --git a/epan/dissectors/packet-ieee80211.c b/epan/dissectors/packet-ieee80211.c index 3355d6b433..1afb415c2f 100644 --- a/epan/dissectors/packet-ieee80211.c +++ b/epan/dissectors/packet-ieee80211.c @@ -12171,7 +12171,8 @@ static tvbuff_t *try_decrypt_wep(tvbuff_t *tvb, guint32 offset, guint32 len) { } } - if ((!decr_tvb) && (tmp)) g_free(tmp); + if (!decr_tvb) + g_free(tmp); #if 0 printf("de-wep %p\n", decr_tvb); @@ -12275,7 +12276,7 @@ void set_airpdcap_keys(void) } } } - if(tmpk != NULL) g_free(tmpk); + g_free(tmpk); } /* Now set the keys */ @@ -12384,9 +12385,7 @@ static void init_wepkeys(void) { g_free(wep_keys[i]); g_free(wep_keys); } - - if (wep_keylens) - g_free(wep_keylens); + g_free(wep_keylens); #ifdef USE_ENV guint8 *buf; @@ -12437,9 +12436,7 @@ static void init_wepkeys(void) { #endif #endif - if (wep_keys[keyidx]) { - g_free(wep_keys[keyidx]); - } + g_free(wep_keys[keyidx]); res = wep_str_to_bytes(tmp, bytes); if (tmp && res && bytes->len > 0) { diff --git a/epan/dissectors/packet-k12.c b/epan/dissectors/packet-k12.c index 58982518a1..ca53bd2c0e 100644 --- a/epan/dissectors/packet-k12.c +++ b/epan/dissectors/packet-k12.c @@ -318,8 +318,7 @@ k12_update_cb(void* r, const char** err) for (num_protos = 0; protos[num_protos]; num_protos++) g_strstrip(protos[num_protos]); - if (h->handles) g_free(h->handles); - + g_free(h->handles); h->handles = g_malloc0(sizeof(dissector_handle_t)*(num_protos < 2 ? 2 : num_protos)); for (i = 0; i < num_protos; i++) { @@ -355,9 +354,10 @@ static void k12_free_cb(void* r) { k12_handles_t* h = r; - if (h->match) g_free(h->match); - if (h->protos) g_free(h->protos); - if (h->handles) g_free(h->handles); + + g_free(h->match); + g_free(h->protos); + g_free(h->handles); } diff --git a/epan/dissectors/packet-kerberos.c b/epan/dissectors/packet-kerberos.c index 06f3d89454..42b9942963 100644 --- a/epan/dissectors/packet-kerberos.c +++ b/epan/dissectors/packet-kerberos.c @@ -533,9 +533,7 @@ decrypt_krb5_data(proto_tree *tree, packet_info *pinfo, input.ciphertext.data = (guint8 *)cryptotext; data.length = length; - if(data.data){ - g_free(data.data); - } + g_free(data.data); data.data = g_malloc(length); key.key.enctype=ek->keytype; @@ -748,8 +746,10 @@ clear_keytab(void) { for(ske = service_key_list; ske != NULL; ske = g_slist_next(ske)){ sk = (service_key_t *) ske->data; - if (sk && sk->contents) g_free(sk->contents); - if (sk) g_free(sk); + if (sk) { + g_free(sk->contents); + g_free(sk); + } } g_slist_free(service_key_list); service_key_list = NULL; diff --git a/epan/dissectors/packet-multipart.c b/epan/dissectors/packet-multipart.c index e10af37a0e..b41bfdd594 100644 --- a/epan/dissectors/packet-multipart.c +++ b/epan/dissectors/packet-multipart.c @@ -435,8 +435,7 @@ cleanup_multipart_info(void *data) { multipart_info_t *m_info = data; if (m_info) { - if (m_info->boundary) - g_free(m_info->boundary); + g_free(m_info->boundary); g_free(m_info); } } @@ -792,10 +791,8 @@ process_body_part(proto_tree *tree, tvbuff_t *tvb, const guint8 *boundary, } } - if(filename) - g_free(filename); - if(typename) - g_free(typename); + g_free(filename); + g_free(typename); return boundary_start + boundary_line_len; } diff --git a/epan/dissectors/packet-rtps.c b/epan/dissectors/packet-rtps.c index 2ff4da4a1e..141e6a3dd4 100644 --- a/epan/dissectors/packet-rtps.c +++ b/epan/dissectors/packet-rtps.c @@ -1577,9 +1577,8 @@ static gint rtps_util_add_string(proto_tree *tree, /* Can be NULL */ g_snprintf(buffer, buffer_size, "%s", retVal); } } - if (retVal != NULL) { - g_free(retVal); - } + g_free(retVal); + /* NDDS align strings at 4-bytes word. So: * string_length: 4 -> buffer_length = 4; * string_length: 5 -> buffer_length = 8; diff --git a/epan/dissectors/packet-rtps2.c b/epan/dissectors/packet-rtps2.c index f64126a2f3..5e2eec8155 100644 --- a/epan/dissectors/packet-rtps2.c +++ b/epan/dissectors/packet-rtps2.c @@ -1795,9 +1795,8 @@ static gint rtps_util_add_string(proto_tree *tree, g_snprintf(buffer, buffer_size, "%s", retVal); } } - if (retVal != NULL) { - g_free(retVal); - } + g_free(retVal); + /* NDDS align strings at 4-bytes word. So: * string_length: 4 -> buffer_length = 4; * string_length: 5 -> buffer_length = 8; diff --git a/epan/dissectors/packet-snmp.c b/epan/dissectors/packet-snmp.c index d56019f9ae..864afef329 100644 --- a/epan/dissectors/packet-snmp.c +++ b/epan/dissectors/packet-snmp.c @@ -3005,12 +3005,12 @@ static void* snmp_users_copy_cb(void* dest, const void* orig, unsigned len _U_) static void snmp_users_free_cb(void* p) { snmp_ue_assoc_t* ue = p; - if (ue->user.userName.data) g_free(ue->user.userName.data); - if (ue->user.authPassword.data) g_free(ue->user.authPassword.data); - if (ue->user.privPassword.data) g_free(ue->user.privPassword.data); - if (ue->user.authKey.data) g_free(ue->user.authKey.data); - if (ue->user.privKey.data) g_free(ue->user.privKey.data); - if (ue->engine.data) g_free(ue->engine.data); + g_free(ue->user.userName.data); + g_free(ue->user.authPassword.data); + g_free(ue->user.privPassword.data); + g_free(ue->user.authKey.data); + g_free(ue->user.privKey.data); + g_free(ue->engine.data); } static void snmp_users_update_cb(void* p _U_, const char** err) { diff --git a/epan/dissectors/packet-ssl-utils.c b/epan/dissectors/packet-ssl-utils.c index ad6fd045b9..be6c40707f 100644 --- a/epan/dissectors/packet-ssl-utils.c +++ b/epan/dissectors/packet-ssl-utils.c @@ -2697,12 +2697,10 @@ ssl_common_init(GHashTable **session_hash, StringInfo *decrypted_data, StringInf g_hash_table_destroy(*session_hash); *session_hash = g_hash_table_new(ssl_hash, ssl_equal); - if (decrypted_data->data) - g_free(decrypted_data->data); + g_free(decrypted_data->data); ssl_data_alloc(decrypted_data, 32); - if (compressed_data->data) - g_free(compressed_data->data); + g_free(compressed_data->data); ssl_data_alloc(compressed_data, 32); } diff --git a/epan/dissectors/packet-user_encap.c b/epan/dissectors/packet-user_encap.c index 26d54ebb82..7859883f5a 100644 --- a/epan/dissectors/packet-user_encap.c +++ b/epan/dissectors/packet-user_encap.c @@ -142,9 +142,9 @@ static void user_free_cb(void* record) { user_encap_t *u = record; - if (u->payload_proto_name) g_free(u->payload_proto_name); - if (u->header_proto_name) g_free(u->header_proto_name); - if (u->trailer_proto_name) g_free(u->trailer_proto_name); + g_free(u->payload_proto_name); + g_free(u->header_proto_name); + g_free(u->trailer_proto_name); } UAT_VS_DEF(user_encap, encap, user_encap_t, WTAP_ENCAP_USER0, ENCAP0_STR) diff --git a/epan/dissectors/packet-xml.c b/epan/dissectors/packet-xml.c index cc09fc0a02..a2d6152b60 100644 --- a/epan/dissectors/packet-xml.c +++ b/epan/dissectors/packet-xml.c @@ -793,15 +793,13 @@ static void add_xmlpi_namespace(gpointer k _U_, gpointer v, gpointer p) { } static void destroy_dtd_data(dtd_build_data_t* dtd_data) { - - if(dtd_data->proto_name) g_free(dtd_data->proto_name); - if(dtd_data->media_type) g_free(dtd_data->media_type); - if(dtd_data->description) g_free(dtd_data->description); - if(dtd_data->proto_root) g_free(dtd_data->proto_root); + g_free(dtd_data->proto_name); + g_free(dtd_data->media_type); + g_free(dtd_data->description); + g_free(dtd_data->proto_root); g_string_free(dtd_data->error,TRUE); - while(dtd_data->elements->len) { dtd_named_list_t* nl = g_ptr_array_remove_index_fast(dtd_data->elements,0); g_ptr_array_free(nl->list,TRUE); @@ -819,10 +817,8 @@ static void destroy_dtd_data(dtd_build_data_t* dtd_data) { g_ptr_array_free(dtd_data->attributes,TRUE); g_free(dtd_data); - } - static void copy_attrib_item(gpointer k, gpointer v _U_, gpointer p) { gchar* key = g_strdup(k); int* value = g_malloc(sizeof(int)); @@ -1036,8 +1032,7 @@ next_attribute: /* if a proto_root is defined in the dtd we'll use that as root */ if( dtd_data->proto_root ) { - if(root_name) - g_free(root_name); + g_free(root_name); root_name = g_strdup(dtd_data->proto_root); } @@ -1186,9 +1181,7 @@ next_attribute: g_hash_table_destroy(elements); destroy_dtd_data(dtd_data); - - if (root_name) - g_free(root_name); + g_free(root_name); } # define DIRECTORY_T GDir |