From: gdt Date: Mon, 22 Dec 2003 20:18:18 +0000 (+0000) Subject: Reorder free(f); unlink(f); to unlink before freeing. X-Git-Tag: frr-2.0-rc1~3831 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=3dbf99698a3be2e920871c3127ea089e061a127c;p=matthieu%2Ffrr.git Reorder free(f); unlink(f); to unlink before freeing. --- diff --git a/lib/ChangeLog b/lib/ChangeLog index 5505686474..6e452c3bbc 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2003-12-22 Greg Troxel + + * vty.c (vty_use_backup_config): Don't free filenames before using + them for unlink. + 2003-08-20 Yasuhiro Ohara * command.c: Fix display problem for command line diff --git a/lib/vty.c b/lib/vty.c index 8ba997080e..6063290c28 100644 --- 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; }