From 96c55ff5bbcd5294ce98f653603e908d51146d84 Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Tue, 19 May 1998 18:37:03 +0000 Subject: [PATCH] Various memory leak fixes. Miguel. --- gnome/ChangeLog | 6 ++++++ gnome/gdesktop.c | 8 +++++--- src/ChangeLog | 4 ++++ src/ext.c | 5 ++++- src/wtools.c | 2 +- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/gnome/ChangeLog b/gnome/ChangeLog index 051d81211..04efe771f 100644 --- a/gnome/ChangeLog +++ b/gnome/ChangeLog @@ -1,3 +1,9 @@ +1998-05-19 Miguel de Icaza + + * gdesktop.c (desktop_reload): Missing mc_closedir + (desktop_setup_icon): Fix memory leak. + (get_desktop_icon): Fix memory leak. + 1998-05-18 Federico Mena Quintero * gscreen.c (x_select_item): Test for full icon visibility instead diff --git a/gnome/gdesktop.c b/gnome/gdesktop.c index 5b7a154cb..255526352 100644 --- a/gnome/gdesktop.c +++ b/gnome/gdesktop.c @@ -220,6 +220,7 @@ get_desktop_icon (char *pathname) /* Try the GNOME icon */ if (fname){ full_fname = gnome_unconditional_pixmap_file (fname); + free (fname); if (exist_file (full_fname)) return full_fname; g_free (full_fname); @@ -654,7 +655,7 @@ desktop_icon_drag_request (GtkWidget *widget, GdkEventDragRequest *event, deskto drop_x = event->drop_coords.x - root_icon_drag_hotspot.x; drop_y = event->drop_coords.y - root_icon_drag_hotspot.y; - /* Icon dropped on root. We take care of it */ + /* Icon dropped on root. We take care of it */ printf ("Dropped at %d %d\n", drop_x, drop_y); if (di->grid_x != -1) @@ -1272,7 +1273,7 @@ desktop_setup_icon (char *filename, char *full_pathname) else desktop_create_directory_entry (dir_full, full_pathname, filename); } - + free (dir_full); } else { if (strstr (filename, ".desktop")){ if (!desktop_pathname_loaded (full_pathname)) @@ -1322,7 +1323,8 @@ desktop_reload (char *desktop_dir) desktop_setup_icon (dent->d_name, full); free (full); } - + mc_closedir (dir); + /* Show all of the widgets */ for (l = desktop_icons; l; l = l->next){ desktop_icon_t *di = l->data; diff --git a/src/ChangeLog b/src/ChangeLog index 03a65f0cf..55172b870 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +1998-05-19 Miguel de Icaza + + * ext.c: Memory leak fixed. + Mon May 18 22:24:09 1998 Norbert Warmuth * lib/mc.ini.in: s/reges/regex/ diff --git a/src/ext.c b/src/ext.c index 274f98a3f..e104a4af8 100644 --- a/src/ext.c +++ b/src/ext.c @@ -422,7 +422,10 @@ file as an example of how to write it.\n\ } mc_stat (filename, &mystat); - regex_command_title = NULL; + if (regex_command_title){ + free (regex_command_title); + regex_command_title = NULL; + } old_patterns = easy_patterns; easy_patterns = 0; /* Real regular expressions are needed :) */ include_target = NULL; diff --git a/src/wtools.c b/src/wtools.c index e1a647fac..b3a00382b 100644 --- a/src/wtools.c +++ b/src/wtools.c @@ -606,7 +606,7 @@ char *real_input_dialog_help (char *header, char *text, char *help, char *def_te len = max (strlen (header), msglen (text, &lines)) + 4; len = max (len, 64); - if (strncmp (text, _("Password:"), strlen (_("Password")) == 0){ + if (strncmp (text, _("Password:"), strlen (_("Password"))) == 0){ quick_widgets [INPUT_INDEX].value = 1; tk_name[3]=0; } else {