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

Wireshark-dev: [Wireshark-dev] Patch for crash in uat_gui.c

From: Peter Johansson <Peter.xc.Johansson@xxxxxxxxxxxx>
Date: Wed, 14 Feb 2007 15:06:39 +0100
Hi!

I have provided a patch for a crash that occurs in uat_gui.c if from the "Edit preferences..." button when you choose Protocols -> DLT_USER -> the "Edit..." button -> the "New" button -> the "Cancel" button. The crash happens because dd gets freed prior to traversing its internal structure, hence I moved the call to g_free for dd beneath the traversal of the dd internals.

Regards, Peter
Index: C:/wireshark-win32-libs/gtk/uat_gui.c
===================================================================
--- C:/wireshark-win32-libs/gtk/uat_gui.c	(revision 20793)
+++ C:/wireshark-win32-libs/gtk/uat_gui.c	(working copy)
@@ -371,10 +371,11 @@
 	if (dd->is_new) g_free(dd->rec);
     g_ptr_array_free(dd->entries,TRUE);
     window_destroy(GTK_WIDGET(dd->win));
-	g_free(dd);
 
 	while (dd->tobe_freed->len) g_free( g_ptr_array_remove_index_fast(dd->tobe_freed, dd->tobe_freed->len - 1 ) );
 	
+	g_free(dd);
+
     return TRUE;
 }