prefs_register_string_preference() overwrites the given value pointer with a copy...
authormorriss <morriss@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 21 Aug 2010 03:44:36 +0000 (03:44 +0000)
committermorriss <morriss@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 21 Aug 2010 03:44:36 +0000 (03:44 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@33872 f5534014-38df-0310-8fa8-9805f1628bb7

plugins/asn1/packet-asn1.c

index 1ce3cf6371f9dfc68124f433b7c19599f49f2ec4..d5a99f598400d52df7cf2ab13243706f75b8b89b 100644 (file)
@@ -2242,7 +2242,7 @@ define_namednumber(GNode *p, GNode *q)
        /* g_message("define_namednumber %p, %p", p, q); */
 
        p = g_node_first_child(p);
-       
+
        if (!p) {
                return;
        }
@@ -4940,6 +4940,7 @@ proto_register_asn1(void) {
 
   module_t *asn1_module;
   int i, j;
+  const char *orig_ptr;
 
   asn1_logfile = get_tempfile_path(ASN1LOGFILE);
 
@@ -5014,14 +5015,23 @@ proto_register_asn1(void) {
   bad_separator_old_default_asn1_filename = get_datafile_path(BAD_SEPARATOR_OLD_DEFAULT_ASN1FILE);
 #endif
 
+  orig_ptr = asn1_filename;
   prefs_register_string_preference(asn1_module, "file",
                                   "ASN.1 type table file",
                                   "Compiled ASN.1 description of ASN.1 types",
                                   &asn1_filename);
+  /* prefs_register_string_preference just overwrite our pointer with a pointer
+   *  to a _copy_ of our string.  Free the original string.
+   */
+  g_free((char *)orig_ptr);
+
+  orig_ptr = asn1_pduname;
   prefs_register_string_preference(asn1_module, "pdu_name",
                                   "ASN.1 PDU name",
                                   "Name of top level PDU",
                                   &asn1_pduname);
+  g_free((char *)orig_ptr);
+
   prefs_register_uint_preference(asn1_module, "first_pdu_offset",
                                 "Offset to first PDU in first tcp packet",
                                 "Offset for non-reassembled packets, "