mirror of https://github.com/MidnightCommander/mc
Fixed memory leak in mc_closedir().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
f547d149ba
commit
3c88948c9d
|
@ -840,21 +840,23 @@ int
|
||||||
mc_closedir (DIR *dirp)
|
mc_closedir (DIR *dirp)
|
||||||
{
|
{
|
||||||
int handle = *(int *) dirp;
|
int handle = *(int *) dirp;
|
||||||
struct vfs_class *vfs = vfs_op (handle);
|
struct vfs_class *vfs;
|
||||||
int result;
|
int result = -1;
|
||||||
struct vfs_dirinfo *dirinfo;
|
|
||||||
|
|
||||||
if (vfs == NULL)
|
vfs = vfs_op (handle);
|
||||||
return -1;
|
if (vfs != NULL) {
|
||||||
|
struct vfs_dirinfo *dirinfo;
|
||||||
|
|
||||||
dirinfo = vfs_info (handle);
|
dirinfo = vfs_info (handle);
|
||||||
if (dirinfo->converter != str_cnv_from_term) str_close_conv (dirinfo->converter);
|
if (dirinfo->converter != str_cnv_from_term)
|
||||||
|
str_close_conv (dirinfo->converter);
|
||||||
|
|
||||||
result = vfs->closedir ? (*vfs->closedir)(dirinfo->info) : -1;
|
result = vfs->closedir ? (*vfs->closedir)(dirinfo->info) : -1;
|
||||||
vfs_free_handle (handle);
|
vfs_free_handle (handle);
|
||||||
g_free (dirinfo);
|
g_free (dirinfo);
|
||||||
|
}
|
||||||
g_free (dirp);
|
g_free (dirp);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mc_stat (const char *filename, struct stat *buf) {
|
int mc_stat (const char *filename, struct stat *buf) {
|
||||||
|
|
Loading…
Reference in New Issue