diff options
author | Hadriel Kaplan <hadrielk@yahoo.com> | 2015-07-20 11:09:06 -0400 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2015-08-18 05:52:45 +0000 |
commit | e25562baddd7a675510daea9bb6a6e4ab36b2d68 (patch) | |
tree | 2338173d5f211716b8004c915ee92713d197c1b1 /tshark.c | |
parent | 4048ca0a27b7ed693b91103ed6912a4a1abfa3db (diff) |
Pcapng: clean up Section Header Block handling
Change-Id: I8516d0c561ed0b63e49a3594027c9c15bb789258
Reviewed-on: https://code.wireshark.org/review/9726
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'tshark.c')
-rw-r--r-- | tshark.c | 16 |
1 files changed, 6 insertions, 10 deletions
@@ -3137,14 +3137,12 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type, wtapng_section_t *shb_hdr = NULL; wtapng_iface_descriptions_t *idb_inf = NULL; wtapng_name_res_t *nrb_hdr = NULL; - char *appname = NULL; struct wtap_pkthdr phdr; Buffer buf; epan_dissect_t *edt = NULL; wtap_phdr_init(&phdr); - shb_hdr = wtap_file_get_shb_info(cf->wth); idb_inf = wtap_file_get_idb_info(cf->wth); #ifdef PCAP_NG_DEFAULT if (idb_inf->interface_data->len > 1) { @@ -3166,12 +3164,13 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type, snapshot_length = WTAP_MAX_PACKET_SIZE; } + shb_hdr = wtap_file_get_shb_for_new_file(cf->wth); nrb_hdr = wtap_file_get_nrb_for_new_file(cf->wth); /* If we don't have an application name add Tshark */ if (shb_hdr->shb_user_appl == NULL) { - appname = g_strdup_printf("TShark (Wireshark) %s", get_ws_vcs_version_info()); - shb_hdr->shb_user_appl = appname; + /* this is free'd by wtap_free_shb() later */ + shb_hdr->shb_user_appl = g_strdup_printf("TShark (Wireshark) %s", get_ws_vcs_version_info()); } if (linktype != WTAP_ENCAP_PER_PACKET && @@ -3382,8 +3381,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type, break; } wtap_dump_close(pdh, &err); - g_free(shb_hdr); - g_free(appname); + wtap_free_shb(shb_hdr); wtap_free_nrb(nrb_hdr); exit(2); } @@ -3488,8 +3486,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type, break; } wtap_dump_close(pdh, &err); - g_free(shb_hdr); - g_free(appname); + wtap_free_shb(shb_hdr); wtap_free_nrb(nrb_hdr); exit(2); } @@ -3603,8 +3600,7 @@ out: cf->wth = NULL; g_free(save_file_string); - g_free(shb_hdr); - g_free(appname); + wtap_free_shb(shb_hdr); wtap_free_nrb(nrb_hdr); return err; |