Re: new pre-release: 20040808

Florian Zaehringer wrote:
Would be great if you could post / send your fix, so I can check if I
corrected it as you did.

ok, here is patch 3,  requires patch 2 already applied.

this has both mem-leaks fixed?

David Jensen
--- emelfm2/plugins/cpbar.c     2004-08-09 10:19:15.000000000 -0500
+++ emelfm2-cvs/plugins/cpbar.c 2004-08-09 12:01:07.379152624 -0500
@@ -342,13 +342,6 @@
                
                if (access(dest, F_OK) == 0)
                {
-                       if ((s = strrchr(dest, '/')) != NULL)
-                               s++;
-                       else
-                               s = dest;
-
-                       gchar *utf = _STR2UTF (s);
-                       
                        struct stat statbuf;
                        lstat(dest, &statbuf);
                        if (S_ISDIR(statbuf.st_mode))
@@ -356,6 +349,13 @@
                                                "cp -rf \"%s\" \"%s\"", src, 
dest_dir);
                        if (check)
                        {
+                               if ((s = strrchr(dest, '/')) != NULL)
+                                       s++;
+                               else
+                                       s = dest;
+
+                               gchar *utf = _STR2UTF (s);
+                       
                                gchar dialog_text[MAX_LEN];
                                g_snprintf (dialog_text, sizeof (dialog_text),
                                        "are you sure you want to overwrite 
<b><u>%s</u></b>?", utf);
@@ -365,6 +365,8 @@
                                         E2_BUTTON_YES_TO_ALL | E2_BUTTON_YES));
                                gint result = gtk_dialog_run (GTK_DIALOG 
(dialog));
                                gtk_widget_destroy (dialog);
+                               
+                               g_free (utf);
 
                                switch (result)
                                {
@@ -385,7 +387,6 @@
                                        continue;
                        } else
                                progbarstruct.process_id = 
exec_and_capture_output_threaded_progbar(command);   
-                       g_free (utf);
                }
     else
                {
@@ -441,6 +442,9 @@
                        }
                }
        }
+       GList *p =g_list_first(const_list);
+       for ( ; p != NULL; p = p->next )
+           g_free(p->data);
        g_list_free(const_list);
        g_free(src_dir);
        g_free(dest_dir);

Other related posts: