Don't pass NULL to wtap_block_set_string_option_value().
authorGuy Harris <guy@alum.mit.edu>
Thu, 21 Jul 2016 02:53:33 +0000 (19:53 -0700)
committerGuy Harris <guy@alum.mit.edu>
Thu, 21 Jul 2016 02:54:03 +0000 (02:54 +0000)
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>
wiretap/merge.c

index 85cc1d9d51c3172a0d929f98d96d7adeb2bb7fe0..89887ffee69d7af8900fc6098dce27b9d66dceb5 100644 (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.          */