Browse Source

2000-09-12 Andrew V. Samoilov <sav@bcs.zp.ua>

	* glayout.c (run_cmd): Memory leak fix: cmd released after use
Andrew V. Samoilov 24 years ago
parent
commit
e3ad216756
2 changed files with 16 additions and 9 deletions
  1. 4 0
      gnome/ChangeLog
  2. 12 9
      gnome/glayout.c

+ 4 - 0
gnome/ChangeLog

@@ -1,3 +1,7 @@
+2000-09-12  Andrew V. Samoilov  <sav@bcs.zp.ua>
+
+	* glayout.c (run_cmd): Memory leak fix: cmd released after use
+
 2000-08-31  Pavel Roskin  <proski@gnu.org>
 
 	* directory-ok.xpm gpopup.c i-device.png image.metadata.in

+ 12 - 9
gnome/glayout.c

@@ -294,14 +294,18 @@ save_panel_types (void)
 			panel_save_setup (pc->panel, pc->panel->panel_name);
 	}
 }
+
 static void
 run_cmd (void)
 {
-	char *cmd;
+	char *cmd = _("Enter command to run");
 
-	cmd = input_dialog (_("Enter command to run"), _("Enter command to run"), "");
-	if (cmd && *cmd){
-		my_system (EXECUTE_AS_SHELL, shell, cmd);
+	cmd = input_dialog (cmd, cmd, "");
+	if (cmd){
+		if (*cmd){
+			my_system (EXECUTE_AS_SHELL, shell, cmd);
+		}
+		g_free (cmd);
 	}
 }
 
@@ -539,15 +543,14 @@ create_new_menu_from (char *file, GtkWidget *shell, gint pos)
 
 	g_return_val_if_fail (shell != NULL, pos);
 
-	dir = opendir (file);
-	if (dir == NULL)
-		return pos;
-
 	if (shell == NULL){
-		closedir (dir);
 		return pos;
 	}
 
+	dir = opendir (file);
+	if (dir == NULL)
+		return pos;
+
 	while ((dirstruc = readdir (dir)) != NULL){
 		if (dirstruc->d_name[0] == '.')
 			continue;