Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] Freeing a GTree in a struct creted with wmem_new0

From: Pascal Quantin <pascal.quantin@xxxxxxxxx>
Date: Sat, 22 Apr 2017 13:54:40 +0200
Hi,

Le 22 avr. 2017 13:49, "ss ws" <sswsdev@xxxxxxxxx> a écrit :
Hey there
I want to add a GTree field to the 'umts_fp_conversation_info_t' struct and want to make sure I'm not creating a memory leak.

This struct is currently created using wmem_new0 with the wmem_file_scope allocator.
I understand that creating and freeing GTrees should be done using g_tree_new_full and g_tree_destroy respectivly

Since the struct is freed automatically when the file is closed, I don't really know where to place the g_tree_destory call. What should I do?

Why not use a wmem_tree? Is there any feature from GTree you need that is not provided by wmem?

Best regards,
Pascal.