Don't pass NULL to wtap_block_set_string_option_value().

To remove OPT_SHB_HARDWARE, use wtap_block_remove_option().

To get the string value from a GString, use g_string_free(string,
FALSE), not g_string_free(string, TRUE) - the latter will free the
string value and return NULL.

Change-Id: I0c5a9f818543f6752f455f04fb3c024208e23954
Reviewed-on: https://code.wireshark.org/review/16567
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2016-07-20 19:53:33 -07:00
parent 52323b20f5
commit d2727ec8a2
1 changed files with 2 additions and 4 deletions

View File

@ -410,11 +410,9 @@ create_shb_header(const merge_in_file_t *in_files, const guint in_file_count,
* XXX - and how do we preserve all the OPT_SHB_HARDWARE, OPT_SHB_OS,
* and OPT_SHB_USERAPPL values from all the previous files?
*/
wtap_block_set_string_option_value(shb_hdr, OPT_SHB_HARDWARE, NULL, 0 ); /* NULL if not available, UTF-8 string containing the */
/* description of the hardware used to create this section. */
wtap_block_remove_option(shb_hdr, OPT_SHB_HARDWARE);
opt_len = os_info_str->len;
wtap_block_set_string_option_value(shb_hdr, OPT_SHB_OS, g_string_free(os_info_str, TRUE), opt_len); /* UTF-8 string containing the name */
wtap_block_set_string_option_value(shb_hdr, OPT_SHB_OS, g_string_free(os_info_str, FALSE), opt_len); /* UTF-8 string containing the name */
/* of the operating system used to create this section. */
wtap_block_set_string_option_value(shb_hdr, OPT_SHB_USERAPPL, (char*)app_name, app_name ? strlen(app_name): 0 ); /* NULL if not available, UTF-8 string containing the name */
/* of the application used to create this section. */