https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=15406
--- Comment #2 from Shinya Sasaki <str230...@gmail.com> ---
In the original code, singly linked list is reversed but attr_list keep a
pointer to its element in proto_tree_write_node_ek. This causes
g_slist_free_full to be passed a pointer to the last element in the list. We
used a patch like below to work around this issue.
static void proto_tree_write_node_ek(proto_node *node, write_json_data *pdata)
{
GSList *attr_list = NULL;
GHashTable *attr_table = g_hash_table_new_full(g_str_hash, g_str_equal,
g_free, NULL);
ek_fill_attr(node, &attr_list, attr_table, pdata);
g_hash_table_destroy(attr_table);
// Print attributes
- GSList *current_attr = g_slist_reverse(attr_list);
+ attr_list = g_slist_reverse(attr_list);
+ GSList *current_attr = attr_list;
while (current_attr != NULL) {
GSList *attr_instances = (GSList *) current_attr->data;
ek_write_attr(attr_instances, pdata);
current_attr = current_attr->next;
if (current_attr != NULL) {
fputs(",", pdata->fh);
}
}
g_slist_free_full(attr_list, (GDestroyNotify) g_slist_free);
}
Unfortunately we aren't familiar with a development procedure of wireshark so
that would be helpful for us if someone apply a patch like above or better
solution to a master code.
--
You are receiving this mail because:
You are watching all bug changes.
___________________________________________________________________________
Sent via: Wireshark-bugs mailing list <wireshark-bugs@wireshark.org>
Archives: https://www.wireshark.org/lists/wireshark-bugs
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-bugs
mailto:wireshark-bugs-requ...@wireshark.org?subject=unsubscribe