Browse Source

(find_parameters): duplicate path when that is really needed.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Andrew Borodin 3 years ago
parent
commit
50f08e2194
1 changed files with 5 additions and 8 deletions
  1. 5 8
      src/filemanager/find.c

+ 5 - 8
src/filemanager/find.c

@@ -782,21 +782,18 @@ find_parameters (WPanel * panel, char **start_dir, ssize_t * start_dir_len,
 
     case B_TREE:
         {
-            char *temp_dir;
+            const char *temp_dir;
 
-            temp_dir = in_start->buffer;
-            if (*temp_dir == '\0' || DIR_IS_DOT (temp_dir))
-                temp_dir = g_strdup (vfs_path_as_str (panel->cwd_vpath));
+            if (input_is_empty (in_start) || DIR_IS_DOT (in_start->buffer))
+                temp_dir = vfs_path_as_str (panel->cwd_vpath);
             else
-                temp_dir = g_strdup (temp_dir);
+                temp_dir = in_start->buffer;
 
             if (in_start_dir != INPUT_LAST_TEXT)
                 g_free (in_start_dir);
             in_start_dir = tree_box (temp_dir);
             if (in_start_dir == NULL)
-                in_start_dir = temp_dir;
-            else
-                g_free (temp_dir);
+                in_start_dir = g_strdup (temp_dir);
 
             input_assign_text (in_start, in_start_dir);