diff options
author | Evan Huus <eapache@gmail.com> | 2012-10-06 20:47:35 +0000 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2012-10-06 20:47:35 +0000 |
commit | 6c56ad1b8d3be6cca8c7741c4b300d256cacf2ad (patch) | |
tree | 8502a925193c0d14ffdd9e320553efcd20f587b5 /epan/radius_dict.l | |
parent | 0d9522c059e14cbf881b69ac237f1d983e208d96 (diff) | |
download | wireshark-6c56ad1b8d3be6cca8c7741c4b300d256cacf2ad.tar.gz |
Work around bug 7803 by not freeing the old name value until after it's been
replaced in the key-set of the hash table. This doesn't really provide proper
behaviour, it just stops us from accessing freed memory.
Also, add modelines.
svn path=/trunk/; revision=45354
Diffstat (limited to 'epan/radius_dict.l')
-rw-r--r-- | epan/radius_dict.l | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/epan/radius_dict.l b/epan/radius_dict.l index 65303df91f..0306ddd663 100644 --- a/epan/radius_dict.l +++ b/epan/radius_dict.l @@ -332,6 +332,7 @@ static void add_attribute(const gchar* name, const gchar* codestr, radius_attr_ radius_attr_info_t* a; GHashTable* by_id; guint32 code; + const gchar *tmpName = NULL; if (current_attr){ @@ -377,12 +378,20 @@ static void add_attribute(const gchar* name, const gchar* codestr, radius_attr_ a->ett = -1; a->tlvs_by_id = NULL; - if (a->name) - g_free((gpointer) a->name); + if (a->name) { + tmpName = a->name; + } a->name = g_strdup(name); g_hash_table_insert(by_id, GUINT_TO_POINTER(code),a); g_hash_table_insert(dict->attrs_by_name,(gpointer) (a->name),a); + + /* Don't free the old name until after the hash_table ops, since it + seems to end up being used in there somewhere, causing valgrind + errors. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7803 */ + if (tmpName) { + g_free((gpointer) tmpName); + } } static void add_tlv(const gchar* name, const gchar* codestr, radius_attr_dissector_t type, const gchar* current_attr) { @@ -627,3 +636,16 @@ gboolean radius_load_dictionary (radius_dictionary_t* d, gchar* dir, const gchar int yywrap(void) { return 1; } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + * + * vi: set shiftwidth=8 tabstop=8 noexpandtab: + * :indentSize=8:tabSize=8:noTabs=false: + */ |