(mc_setup_by_args): fixed memory leaks.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2012-04-20 14:40:04 +04:00 committed by Slava Zanko
parent bd4a696ab6
commit 25315360bd

View File

@ -655,6 +655,7 @@ mc_setup_by_args (int argc, char **argv, GError ** error)
char *fname; char *fname;
struct stat st; struct stat st;
vfs_path_t *tmp_vpath, *fname_vpath; vfs_path_t *tmp_vpath, *fname_vpath;
gboolean ok;
fname = g_strndup (tmp, p - 1 - tmp); fname = g_strndup (tmp, p - 1 - tmp);
tmp_vpath = vfs_path_from_str (tmp); tmp_vpath = vfs_path_from_str (tmp);
@ -663,7 +664,11 @@ mc_setup_by_args (int argc, char **argv, GError ** error)
* Check that the file before the colon actually exists. * Check that the file before the colon actually exists.
* If it doesn't exist, revert to the old behavior. * If it doesn't exist, revert to the old behavior.
*/ */
if (mc_stat (tmp_vpath, &st) == -1 && mc_stat (fname_vpath, &st) != -1) ok = mc_stat (tmp_vpath, &st) == -1 && mc_stat (fname_vpath, &st) != -1;
vfs_path_free (tmp_vpath);
vfs_path_free (fname_vpath);
if (ok)
{ {
mc_run_param0 = fname; mc_run_param0 = fname;
mc_args__edit_start_line = atoi (p); mc_args__edit_start_line = atoi (p);
@ -673,8 +678,6 @@ mc_setup_by_args (int argc, char **argv, GError ** error)
g_free (fname); g_free (fname);
goto try_plus_filename; goto try_plus_filename;
} }
vfs_path_free (tmp_vpath);
vfs_path_free (fname_vpath);
} }
else else
{ {