diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-01-13 15:13:40 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2015-01-13 23:14:13 +0000 |
commit | 63a3d043e3f14eebb0798a250d9aecdc8e89dfb9 (patch) | |
tree | 69a58dd4cadfc7f98669cba229e76fa8c60e0761 /ui/tap_export_pdu.c | |
parent | 9f5e4fb7a51741a286ce5bc92a6f335ed58587a2 (diff) |
Consistently use the "g_string_free returns a C string pointer" idiom.
g_string_free(str, FALSE) frees the GString container but not the
underlying g_malloc()ed string; instead, it returns a pointer to the
g_malloc()ed string.
Fix those places that didn't already get the string pointer from
g_string_free() to do so rather than manually extracting the string
themselves.
And fix one place that didn't even need to use a string - it was just
scanning a C string without even modifying it.
Change-Id: Ibbf4872bf5b9935b9907f539b6edb1013f3053a5
Reviewed-on: https://code.wireshark.org/review/6532
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui/tap_export_pdu.c')
-rw-r--r-- | ui/tap_export_pdu.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/ui/tap_export_pdu.c b/ui/tap_export_pdu.c index 48c112cec1..a08f78f260 100644 --- a/ui/tap_export_pdu.c +++ b/ui/tap_export_pdu.c @@ -123,17 +123,21 @@ exp_pdu_file_open(exp_pdu_t *exp_pdu_tap_data) shb_hdr->section_length = -1; /* options */ shb_hdr->opt_comment = g_strdup_printf("Dump of PDUs from %s", cfile.filename); - shb_hdr->shb_hardware = NULL; /* UTF-8 string containing the - * description of the hardware used to create this section. - */ - shb_hdr->shb_os = os_info_str->str; /* UTF-8 string containing the name - * of the operating system used to create this section. - */ - g_string_free(os_info_str, FALSE); /* The actual string is not freed */ - shb_hdr->shb_user_appl = appname; /* UTF-8 string containing the name - * of the application used to create this section. - */ - + /* + * UTF-8 string containing the description of the hardware used to create + * this section. + */ + shb_hdr->shb_hardware = NULL; + /* + * UTF-8 string containing the name of the operating system used to create + * this section. + */ + shb_hdr->shb_os = g_string_free(os_info_str, FALSE); + /* + * UTF-8 string containing the name of the application used to create + * this section. + */ + shb_hdr->shb_user_appl = appname; /* Create fake IDB info */ idb_inf = g_new(wtapng_iface_descriptions_t,1); |