ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

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

From: ss ws <sswsdev@xxxxxxxxx>
Date: Sat, 22 Apr 2017 14:59:50 +0300
Actually I was not aware of wmem_tree.
looking at the .h file seems like this would fit my needs.

Thank you!

On Sat, Apr 22, 2017 at 2:54 PM, Pascal Quantin <pascal.quantin@xxxxxxxxx> wrote:
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. 


___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@wireshark.org?subject=unsubscribe