Reorder free(f); unlink(f); to unlink before freeing.

This commit is contained in:
gdt 2003-12-22 20:18:18 +00:00
parent aa593d5e26
commit 3dbf99698a
2 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2003-12-22 Greg Troxel <gdt@fnord.ir.bbn.com>
* vty.c (vty_use_backup_config): Don't free filenames before using
them for unlink.
2003-08-20 Yasuhiro Ohara <yasu@sfc.wide.ad.jp> 2003-08-20 Yasuhiro Ohara <yasu@sfc.wide.ad.jp>
* command.c: Fix <cr> display problem for command line * command.c: Fix <cr> display problem for command line

View File

@ -2173,9 +2173,9 @@ vty_use_backup_config (char *fullpath)
sav = open (fullpath_sav, O_RDONLY); sav = open (fullpath_sav, O_RDONLY);
if (sav < 0) if (sav < 0)
{ {
unlink (fullpath_tmp);
free (fullpath_sav); free (fullpath_sav);
free (fullpath_tmp); free (fullpath_tmp);
unlink (fullpath_tmp);
return NULL; return NULL;
} }
@ -2187,9 +2187,9 @@ vty_use_backup_config (char *fullpath)
if (chmod(fullpath_tmp, CONFIGFILE_MASK) != 0) if (chmod(fullpath_tmp, CONFIGFILE_MASK) != 0)
{ {
unlink (fullpath_tmp);
free (fullpath_sav); free (fullpath_sav);
free (fullpath_tmp); free (fullpath_tmp);
unlink (fullpath_tmp);
return NULL; return NULL;
} }