Ethereal-dev: [Ethereal-dev] prefs.c patch

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Gisle Vanem" <giva@xxxxxxxxx>
Date: Sat, 8 Nov 2003 21:23:18 +0100
The 'gui_fileopen_*' fields where missing in copy_prefs().
And a typo in free_prefs() caused a mem leak.

This caused a crash when cancelling the Preference dialog and
opening a new offline capture.

--- ethereal-2003-11-08\prefs.c Wed Oct 22 23:13:12 2003
+++ prefs.c     Sat Nov 08 21:10:35 2003
@@ -2238,6 +2238,9 @@
   dest->gui_hex_dump_highlight_style = src->gui_hex_dump_highlight_style;
   dest->gui_toolbar_main_show = src->gui_toolbar_main_show;
   dest->gui_toolbar_main_style = src->gui_toolbar_main_style;
+  dest->gui_fileopen_dir = g_strdup(src->gui_fileopen_dir);
+  dest->gui_fileopen_remembered_dir = g_strdup(src->gui_fileopen_remembered_dir);
+  dest->gui_fileopen_style = src->gui_fileopen_style;
   dest->gui_font_name = g_strdup(src->gui_font_name);
   dest->gui_marked_fg = src->gui_marked_fg;
   dest->gui_marked_bg = src->gui_marked_bg;
@@ -2280,7 +2283,7 @@
     g_free(pr->gui_fileopen_dir);
     pr->gui_fileopen_dir = NULL;
   }
-  if (pr->gui_fileopen_dir != NULL) {
+  if (pr->gui_fileopen_remembered_dir != NULL) {
     g_free(pr->gui_fileopen_remembered_dir);
     pr->gui_fileopen_remembered_dir = NULL;
   }

--gv