void wtap_close(wtap *wth) { wtap_sequential_close(wth); if (wth->subtype_close != NULL) (*wth->subtype_close)(wth); if (wth->random_fh != NULL) file_close(wth->random_fh); g_free(wth->priv); if (wth->fast_seek != NULL) { g_ptr_array_foreach(wth->fast_seek, g_fast_seek_item_free, NULL); g_ptr_array_free(wth->fast_seek, TRUE); } wtap_block_array_free(wth->shb_hdrs); wtap_block_array_free(wth->nrb_hdrs); wtap_block_array_free(wth->interface_data); wtap_block_array_free(wth->dsbs); g_free(wth); }
void wtap_close(wtap *wth) { gint i, j; wtapng_if_descr_t *wtapng_if_descr; wtapng_if_stats_t *if_stats; wtap_sequential_close(wth); if (wth->subtype_close != NULL) (*wth->subtype_close)(wth); if (wth->random_fh != NULL) file_close(wth->random_fh); if (wth->priv != NULL) g_free(wth->priv); if (wth->fast_seek != NULL) { g_ptr_array_foreach(wth->fast_seek, g_fast_seek_item_free, NULL); g_ptr_array_free(wth->fast_seek, TRUE); } for(i = 0; i < (gint)wth->number_of_interfaces; i++) { wtapng_if_descr = &g_array_index(wth->interface_data, wtapng_if_descr_t, i); if(wtapng_if_descr->opt_comment != NULL){ g_free(wtapng_if_descr->opt_comment); } if(wtapng_if_descr->if_name != NULL){ g_free(wtapng_if_descr->if_name); } if(wtapng_if_descr->if_description != NULL){ g_free(wtapng_if_descr->if_description); } if(wtapng_if_descr->if_filter_str != NULL){ g_free(wtapng_if_descr->if_filter_str); } if(wtapng_if_descr->if_filter_bpf_bytes != NULL){ g_free(wtapng_if_descr->if_filter_bpf_bytes); } if(wtapng_if_descr->if_os != NULL){ g_free(wtapng_if_descr->if_os); } for(j = 0; j < (gint)wtapng_if_descr->num_stat_entries; j++) { if_stats = &g_array_index(wtapng_if_descr->interface_statistics, wtapng_if_stats_t, j); if(if_stats->opt_comment != NULL){ g_free(if_stats->opt_comment); } } if(wtapng_if_descr->num_stat_entries != 0){ g_array_free(wtapng_if_descr->interface_statistics, TRUE); } } if(wth->number_of_interfaces != 0){ g_array_free(wth->interface_data, TRUE); } g_free(wth); }