diff --git a/lib/vfs/gc.c b/lib/vfs/gc.c index 11dddb757..a1e16e530 100644 --- a/lib/vfs/gc.c +++ b/lib/vfs/gc.c @@ -272,6 +272,7 @@ vfs_release_path (const char *dir) path_element = vfs_path_get_by_index (vpath, -1); vfs_stamp_create (path_element->class, vfs_getid (vpath)); + vfs_path_free (vpath); } /* --------------------------------------------------------------------------------------------- */ diff --git a/lib/vfs/interface.c b/lib/vfs/interface.c index 3eabea1ae..c939605e9 100644 --- a/lib/vfs/interface.c +++ b/lib/vfs/interface.c @@ -451,6 +451,7 @@ mc_opendir (const char *dirname) if (info == NULL) { errno = path_element->class->opendir ? vfs_ferrno (path_element->class) : E_NOTSUPP; + vfs_path_free (vpath); return NULL; } @@ -462,10 +463,11 @@ mc_opendir (const char *dirname) if (path_element->dir.converter == INVALID_CONV) path_element->dir.converter = str_cnv_from_term; - handle = vfs_new_handle (path_element->class, path_element); + handle = vfs_new_handle (path_element->class, vfs_path_element_clone (path_element)); handlep = g_new (int, 1); *handlep = handle; + vfs_path_free (vpath); return (DIR *) handlep; } @@ -726,6 +728,7 @@ mc_chdir (const char *path) if (result == -1) { errno = vfs_ferrno (path_element->class); + vfs_path_free (vpath); return -1; } diff --git a/lib/vfs/path.c b/lib/vfs/path.c index 4cbb82d35..07ce235e5 100644 --- a/lib/vfs/path.c +++ b/lib/vfs/path.c @@ -713,6 +713,8 @@ vfs_path_element_clone (const vfs_path_element_t * element) new_element->host = g_strdup (element->host); new_element->path = g_strdup (element->path); new_element->encoding = g_strdup (element->encoding); + if (vfs_path_element_need_cleanup_converter (element) && new_element->encoding != NULL) + new_element->dir.converter = str_crt_conv_from (new_element->encoding); new_element->vfs_prefix = g_strdup (element->vfs_prefix); return new_element; diff --git a/src/filemanager/midnight.c b/src/filemanager/midnight.c index f547683bc..88d07c1e9 100644 --- a/src/filemanager/midnight.c +++ b/src/filemanager/midnight.c @@ -481,10 +481,17 @@ check_panel_timestamp (const WPanel * panel, panel_view_mode_t mode, struct vfs_ path_element = vfs_path_get_by_index (vpath, -1); if (path_element->class != vclass) + { + vfs_path_free (vpath); return FALSE; + } if (vfs_getid (vpath) != id) + { + vfs_path_free (vpath); return FALSE; + } + vfs_path_free (vpath); } return TRUE; }