]> git.puffer.fish Git - mirror/frr.git/commitdiff
Reorder free(f); unlink(f); to unlink before freeing.
authorgdt <gdt>
Mon, 22 Dec 2003 20:18:18 +0000 (20:18 +0000)
committergdt <gdt>
Mon, 22 Dec 2003 20:18:18 +0000 (20:18 +0000)
lib/ChangeLog
lib/vty.c

index 550568647407d6fb9c10a5817d69a4012e46b83d..6e452c3bbcf3d3d3fba1cdf7c7e6222be2b537c7 100644 (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>
 
        * command.c: Fix <cr> display problem for command line
index 8ba997080e8cdb1554a10b8abd2ce1fe66c62616..6063290c28fade5908a9f89d570a20d48b0d34e7 100644 (file)
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -2173,9 +2173,9 @@ vty_use_backup_config (char *fullpath)
   sav = open (fullpath_sav, O_RDONLY);
   if (sav < 0)
     {
+      unlink (fullpath_tmp);
       free (fullpath_sav);
       free (fullpath_tmp);
-      unlink (fullpath_tmp);
       return NULL;
     }
   
@@ -2187,9 +2187,9 @@ vty_use_backup_config (char *fullpath)
   
   if (chmod(fullpath_tmp, CONFIGFILE_MASK) != 0)
     {
+      unlink (fullpath_tmp);
       free (fullpath_sav);
       free (fullpath_tmp);
-      unlink (fullpath_tmp);
       return NULL;
     }