diff options
author | Jeff Morriss <jeff.morriss@ulticom.com> | 2010-08-21 03:44:36 +0000 |
---|---|---|
committer | Jeff Morriss <jeff.morriss@ulticom.com> | 2010-08-21 03:44:36 +0000 |
commit | d2b84da490db34922c7138b20da2e3806fc7e10b (patch) | |
tree | 5c942307f7019d5505754cfbe63fd3bcf514a13d /plugins | |
parent | b05ee41bc008c5a8141ec75605538965afb0e5e8 (diff) |
prefs_register_string_preference() overwrites the given value pointer with a copy of the string. Since the string this dissector passes in is mallocated, keep a pointer to it and then free it after the pointer has been overwritten.
svn path=/trunk/; revision=33872
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/asn1/packet-asn1.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/plugins/asn1/packet-asn1.c b/plugins/asn1/packet-asn1.c index 1ce3cf6371..d5a99f5984 100644 --- a/plugins/asn1/packet-asn1.c +++ b/plugins/asn1/packet-asn1.c @@ -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, " |