diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-01-03 14:35:01 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2015-01-03 22:35:27 +0000 |
commit | 938485436e7b7c647323a147c8ea1abc33e07564 (patch) | |
tree | 2c0ce27222b3a8f08c950b1d8655f04557286d21 /tshark.c | |
parent | 9df73862fbb2ad7eecdad335714fa6a0487c1973 (diff) |
Use g_strdup_printf(), rather than a fixed-length buffer, for the app name.
Add some missing g_free()s while we're at it.
Change-Id: Id38acc21d3c0b337e5d05baaf5ebbcd63699ff50
Reviewed-on: https://code.wireshark.org/review/6287
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'tshark.c')
-rw-r--r-- | tshark.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -3094,7 +3094,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type, guint tap_flags; wtapng_section_t *shb_hdr; wtapng_iface_descriptions_t *idb_inf; - char appname[100]; + char *appname = NULL; struct wtap_pkthdr phdr; Buffer buf; epan_dissect_t *edt = NULL; @@ -3124,7 +3124,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type, } /* If we don't have an application name add Tshark */ if (shb_hdr->shb_user_appl == NULL) { - g_snprintf(appname, sizeof(appname), "TShark (Wireshark) %s", get_ws_vcs_version_info()); + appname = g_strdup_printf("TShark (Wireshark) %s", get_ws_vcs_version_info()); shb_hdr->shb_user_appl = appname; } @@ -3337,6 +3337,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type, } wtap_dump_close(pdh, &err); g_free(shb_hdr); + g_free(appname); exit(2); } } @@ -3440,6 +3441,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type, } wtap_dump_close(pdh, &err); g_free(shb_hdr); + g_free(appname); exit(2); } } @@ -3553,6 +3555,7 @@ out: g_free(save_file_string); g_free(shb_hdr); + g_free(appname); return err; } |