Adding a missing malloc, to avoid a segfault on some systems.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4595 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2014-02-22 20:44:43 +00:00
parent c4520d57aa
commit 4abf9449b4
2 changed files with 7 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2014-02-22 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (write_file) - Add a missing malloc.
Reported by an anonymous cross compiler, bug #30671.
2014-02-22 Benno Schulenberg <bensberg@justemail.net> 2014-02-22 Benno Schulenberg <bensberg@justemail.net>
* src/winio.c (get_mouseinput) - Correct an oversight, * src/winio.c (get_mouseinput) - Correct an oversight,
use the proper 'do_up_void' and 'do_down_void' names. use the proper 'do_up_void' and 'do_down_void' names.

View File

@ -1746,8 +1746,10 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
* specified it interactively), stat and save the value * specified it interactively), stat and save the value
* or else we will chase null pointers when we do * or else we will chase null pointers when we do
* modtime checks, preserve file times, etc. during backup */ * modtime checks, preserve file times, etc. during backup */
if (openfile->current_stat == NULL && !tmp && realexists) if (openfile->current_stat == NULL && !tmp && realexists) {
openfile->current_stat = (struct stat *)nmalloc(sizeof(struct stat));
stat(realname, openfile->current_stat); stat(realname, openfile->current_stat);
}
/* We backup only if the backup toggle is set, the file isn't /* We backup only if the backup toggle is set, the file isn't
* temporary, and the file already exists. Furthermore, if we * temporary, and the file already exists. Furthermore, if we