diff options
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 38 |
1 files changed, 16 insertions, 22 deletions
@@ -4448,15 +4448,11 @@ cf_save_records(capture_file *cf, const char *fname, guint save_format, or moving the capture file, we have to do it by writing the packets out in Wiretap. */ - GArray *shb_hdrs = NULL; - wtapng_iface_descriptions_t *idb_inf = NULL; - GArray *nrb_hdrs = NULL; + wtapng_dump_params ng_params; int encap; - /* XXX: what free's this shb_hdr? */ - shb_hdrs = wtap_file_get_shb_for_new_file(cf->provider.wth); - idb_inf = wtap_file_get_idb_info(cf->provider.wth); - nrb_hdrs = wtap_file_get_nrb_for_new_file(cf->provider.wth); + /* XXX: what free's ng_params.shb_hdr? */ + wtap_dump_params_init(&ng_params, cf->provider.wth); /* Determine what file encapsulation type we should use. */ encap = wtap_dump_file_encap_type(cf->linktypes); @@ -4471,13 +4467,14 @@ cf_save_records(capture_file *cf, const char *fname, guint save_format, from which we're reading the packets that we're writing!) */ fname_new = g_strdup_printf("%s~", fname); pdh = wtap_dump_open_ng(fname_new, save_format, encap, cf->snap, - compressed, shb_hdrs, idb_inf, nrb_hdrs, &err); + compressed, &ng_params, &err); } else { pdh = wtap_dump_open_ng(fname, save_format, encap, cf->snap, - compressed, shb_hdrs, idb_inf, nrb_hdrs, &err); + compressed, &ng_params, &err); } - g_free(idb_inf); - idb_inf = NULL; + /* XXX idb_inf is documented to be used until wtap_dump_close. */ + g_free(ng_params.idb_inf); + ng_params.idb_inf = NULL; if (pdh == NULL) { cfile_dump_open_failure_alert_box(fname, err, save_format); @@ -4698,9 +4695,7 @@ cf_export_specified_packets(capture_file *cf, const char *fname, int err; wtap_dumper *pdh; save_callback_args_t callback_args; - GArray *shb_hdrs = NULL; - wtapng_iface_descriptions_t *idb_inf = NULL; - GArray *nrb_hdrs = NULL; + wtapng_dump_params ng_params; int encap; packet_range_process_init(range); @@ -4710,10 +4705,8 @@ cf_export_specified_packets(capture_file *cf, const char *fname, written, don't special-case the operation - read each packet and then write it out if it's one of the specified ones. */ - /* XXX: what free's this shb_hdr? */ - shb_hdrs = wtap_file_get_shb_for_new_file(cf->provider.wth); - idb_inf = wtap_file_get_idb_info(cf->provider.wth); - nrb_hdrs = wtap_file_get_nrb_for_new_file(cf->provider.wth); + /* XXX: what free's ng_params.shb_hdr? */ + wtap_dump_params_init(&ng_params, cf->provider.wth); /* Determine what file encapsulation type we should use. */ encap = wtap_dump_file_encap_type(cf->linktypes); @@ -4728,13 +4721,14 @@ cf_export_specified_packets(capture_file *cf, const char *fname, from which we're reading the packets that we're writing!) */ fname_new = g_strdup_printf("%s~", fname); pdh = wtap_dump_open_ng(fname_new, save_format, encap, cf->snap, - compressed, shb_hdrs, idb_inf, nrb_hdrs, &err); + compressed, &ng_params, &err); } else { pdh = wtap_dump_open_ng(fname, save_format, encap, cf->snap, - compressed, shb_hdrs, idb_inf, nrb_hdrs, &err); + compressed, &ng_params, &err); } - g_free(idb_inf); - idb_inf = NULL; + /* XXX idb_inf is documented to be used until wtap_dump_close. */ + g_free(ng_params.idb_inf); + ng_params.idb_inf = NULL; if (pdh == NULL) { cfile_dump_open_failure_alert_box(fname, err, save_format); |