Cleanup the unregister loop to avoid freeing wrong data.
authorstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 5 Oct 2011 11:44:29 +0000 (11:44 +0000)
committerstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 5 Oct 2011 11:44:29 +0000 (11:44 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@39268 f5534014-38df-0310-8fa8-9805f1628bb7

epan/dissectors/packet-http.c

index a00d35a240bd05ebeeed40243518a9b85b1049e3..cef874a9643fc4512bf1738cd2c21879dba9f3f7 100644 (file)
@@ -1908,14 +1908,12 @@ header_fields_initialize_cb(void)
        gchar* header_name;
 
        if (header_fields_hash) {
-               GList *hf_ids = g_hash_table_get_values (header_fields_hash);
                guint hf_size = g_hash_table_size (header_fields_hash);
                /* Unregister all fields */
                for (i = 0; i < hf_size; i++) {
-                       hf_id = (int *) g_list_nth_data (hf_ids, i);
-                       proto_unregister_field (proto_http, *hf_id);
+                       proto_unregister_field (proto_http, *(hf[i].p_id));
 
-                       g_free (hf_id);
+                       g_free (hf[i].p_id);
                        g_free ((char *) hf[i].hfinfo.name);
                        g_free ((char *) hf[i].hfinfo.abbrev);
                        g_free ((char *) hf[i].hfinfo.blurb);