Ensure pcapng application name is always dynamically allocated
authorEvan Huus <eapache@gmail.com>
Mon, 22 Sep 2014 20:53:02 +0000 (16:53 -0400)
committerEvan Huus <eapache@gmail.com>
Mon, 22 Sep 2014 20:53:44 +0000 (20:53 +0000)
Change-Id: I408944dfb0fa35bae6019ed0d6d810525b2ffcae
Reviewed-on: https://code.wireshark.org/review/4254
Reviewed-by: Evan Huus <eapache@gmail.com>
editcap.c
mergecap.c

index 2c7ca6612819609d0cd3992723d332bb87082b86..199fac3a597b9d8b72fbb7bc3bd85af9dd728633 100644 (file)
--- a/editcap.c
+++ b/editcap.c
@@ -1308,7 +1308,7 @@ main(int argc, char *argv[])
 
                 /* If we don't have an application name add Editcap */
                 if (shb_hdr->shb_user_appl == NULL) {
-                    shb_hdr->shb_user_appl = "Editcap " VERSION;
+                    shb_hdr->shb_user_appl = g_strdup("Editcap " VERSION);
                 }
 
                 pdh = wtap_dump_open_ng(filename, out_file_type_subtype, out_frame_type,
index 3e26f9c6825647ebb405927265bcc84db7666121..94c86612522bf1c3069d65b4bb17f46557486dc5 100644 (file)
@@ -467,7 +467,7 @@ main(int argc, char *argv[])
     shb_hdr->opt_comment   = comment_gstr->str; /* NULL if not available */
     shb_hdr->shb_hardware  = NULL;              /* NULL if not available, UTF-8 string containing the description of the hardware used to create this section. */
     shb_hdr->shb_os        = NULL;              /* NULL if not available, UTF-8 string containing the name of the operating system used to create this section. */
-    shb_hdr->shb_user_appl = "mergecap";        /* NULL if not available, UTF-8 string containing the name of the application used to create this section. */
+    shb_hdr->shb_user_appl = g_strdup("mergecap"); /* NULL if not available, UTF-8 string containing the name of the application used to create this section. */
 
     pdh = wtap_dump_fdopen_ng(out_fd, file_type, frame_type, snaplen,
                               FALSE /* compressed */, shb_hdr, NULL /* wtapng_iface_descriptions_t *idb_inf */, &open_err);