This is our old Q&A Site. Please post any new questions and answers at

I'm working on developing a Wireshark dissector that includes a UAT. I'm getting an error that I'm not sure how to fix or even look for information that helps with fixing it. When I run Wireshark, it starts normally. However, when I open a dump file that uses my own dissector it crashes reporting a long message in the terminal ended with the following:

7fc2e49ac000-7fc2e49c7000 r-xp 00000000 08:01 2491310                    /home/flora/wireshark_with_my_dissector/wsutil/.libs/
7fc2e49c7000-7fc2e4bc6000 ---p 0001b000 08:01 2491310                    /home/flora/wireshark_with_my_dissector/wsutil/.libs/
7fc2e4bc6000-7fc2e4bc7000 r--p 0001a000 08:01 2491310                    /home/flora/wireshark_with_my_dissector/wsutil/.libs/ (core dumped)

By using printif statements, I found that Wireshark seems to be crashing at a function called g_free(). This function is called by my_dissector_key_free() which is called in function: **g_hash_table_foreach(my_dissector_key_hash, my_dissector_key_free, NULL);** when parsing the uat I've created to be used with my dissector.

Any idea what this error could be about? what is wsutil? what does any line of the output (for example the following line) could mean

7fc2e4bc6000-7fc2e4bc7000 r--p 0001a000 08:01 2491310

In case it matters, I'm developing in Linux (Ubuntu).

Thank you. flora.

asked 02 Jan '15, 16:36

flora's gravatar image

accept rate: 100%

edited 02 Jan '15, 19:11

How did you allocate the memory been freed with g_free()? Is it using g_malloc or another function?

(02 Jan '15, 23:58) Pascal Quantin

Thanks for your comments Pascal. It is a hash table that I declared as static GHashTable *my_dissector_key_hash = NULL;

and then I wanted to free it by using g_free() before creating a hash by using my_dissector_key_hash = g_hash_table_new() which is described in this link

(03 Jan '15, 00:45) flora

No this g_free call is presumably for the elements of the hash table, and not the hash table itself (as you are using g_hash_table_foreach). So how are you allocating the elements put in the hash table (through the g_hash_table_insert function call)?

(03 Jan '15, 02:01) Pascal Quantin

Oh sorry I misunderstood it. I'm using g_malloc() for the allocation.

(03 Jan '15, 18:02) flora

OK then g_free should work. If you get a crash, it means that you are corrupting your hash table; or trying to free a parameter that was not dynamically allocated (could be either the key itself or associated value, but according to what you shared earlier it seems to be the key). You should carefully reread your code and use a debugger to step in (instead of using printf).

(04 Jan '15, 01:35) Pascal Quantin

works perfect thanks.

(13 Jan '15, 18:18) flora
showing 5 of 6 show 1 more comments

Pascal's last comments helped me to understand the problem and to solve it.

permanent link

answered 13 Jan '15, 18:20

flora's gravatar image

accept rate: 100%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 02 Jan '15, 16:36

question was seen: 1,343 times

last updated: 13 Jan '15, 18:20

p​o​w​e​r​e​d by O​S​Q​A