mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
Ticket #3458: (dir_list_reload): fix memory leak.
Handling dir_copy list as full copy for avoid double free situations. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
a382b1558b
commit
290978e536
@ -721,7 +721,7 @@ dir_list_reload (dir_list * list, const vfs_path_t * vpath, GCompareFunc sort,
|
||||
dfentry = &dir_copy.list[i];
|
||||
|
||||
dfentry->fnamelen = fentry->fnamelen;
|
||||
dfentry->fname = fentry->fname;
|
||||
dfentry->fname = g_strndup (fentry->fname, fentry->fnamelen);
|
||||
dfentry->f.marked = fentry->f.marked;
|
||||
dfentry->f.dir_size_computed = fentry->f.dir_size_computed;
|
||||
dfentry->f.link_to_dir = fentry->f.link_to_dir;
|
||||
@ -748,6 +748,7 @@ dir_list_reload (dir_list * list, const vfs_path_t * vpath, GCompareFunc sort,
|
||||
}
|
||||
else
|
||||
{
|
||||
dir_list_clean (list);
|
||||
if (!dir_list_init (list))
|
||||
{
|
||||
dir_list_clean (&dir_copy);
|
||||
|
Loading…
Reference in New Issue
Block a user