Fixed memory leak in mc_closedir().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2010-03-07 14:04:35 +03:00
parent f547d149ba
commit 3c88948c9d
1 changed files with 13 additions and 11 deletions

View File

@ -840,21 +840,23 @@ int
mc_closedir (DIR *dirp)
{
int handle = *(int *) dirp;
struct vfs_class *vfs = vfs_op (handle);
int result;
struct vfs_dirinfo *dirinfo;
struct vfs_class *vfs;
int result = -1;
if (vfs == NULL)
return -1;
vfs = vfs_op (handle);
if (vfs != NULL) {
struct vfs_dirinfo *dirinfo;
dirinfo = vfs_info (handle);
if (dirinfo->converter != str_cnv_from_term) str_close_conv (dirinfo->converter);
dirinfo = vfs_info (handle);
if (dirinfo->converter != str_cnv_from_term)
str_close_conv (dirinfo->converter);
result = vfs->closedir ? (*vfs->closedir)(dirinfo->info) : -1;
vfs_free_handle (handle);
g_free (dirinfo);
result = vfs->closedir ? (*vfs->closedir)(dirinfo->info) : -1;
vfs_free_handle (handle);
g_free (dirinfo);
}
g_free (dirp);
return result;
return result;
}
int mc_stat (const char *filename, struct stat *buf) {