]> git.wh0rd.org Git - nano.git/commitdiff
in write_file(), don't free backupname before displaying it in a
authorDavid Lawrence Ramsey <pooka109@gmail.com>
Wed, 5 Apr 2006 02:56:47 +0000 (02:56 +0000)
committerDavid Lawrence Ramsey <pooka109@gmail.com>
Wed, 5 Apr 2006 02:56:47 +0000 (02:56 +0000)
statusbar error message

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3347 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

ChangeLog
src/files.c

index dd62b64ac619ab8e206bd3f47bd48207dd0ff711..ad58bad2ff074a80daae9f6de412e28addc8808a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,10 @@ CVS code -
          do_last_file(), do_help_void(), and do_browser_help(); changes
          to do_browser(), parse_browser_input(), shortcut_init(),
          do_help(), and help_init(). (DLR)
+- files.c:
+  write_file()
+       - Don't free backupname before displaying it in a statusbar error
+         message. (DLR, found by Bill Marcum)
 - doc/nano.1, doc/nanorc.5, doc/rnano.1, doc/nano.texi:
        - Update the copyright years to include 2006. (DLR)
 - doc/nanorc.sample:
index f5be6061a865030644307a1512f69a87dfeb7c4e..0caf5f18a63c38b510174f8c062d45d8e730336e 100644 (file)
@@ -1414,7 +1414,6 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
                openfile->current_stat->st_uid,
                openfile->current_stat->st_gid) == -1 ||
                utime(backupname, &filetime) == -1) {
-           free(backupname);
            if (copy_status == -1) {
                statusbar(_("Error reading %s: %s"), realname,
                        strerror(errno));
@@ -1422,6 +1421,7 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
            } else
                statusbar(_("Error writing %s: %s"), backupname,
                        strerror(errno));
+           free(backupname);
            goto cleanup_and_exit;
        }