Plugging a memory leak by not copying a string twice.
This fixes Savannah bug #47206. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5676 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
16c037fdb0
commit
761fa7cd3a
|
@ -1,3 +1,7 @@
|
||||||
|
2016-02-25 Benno Schulenberg <bensberg@justemail.net>
|
||||||
|
* src/browser.c (do_browser): Plug a memory leak by not copying
|
||||||
|
a string twice. This fixes Savannah bug #47206.
|
||||||
|
|
||||||
2016-02-23 Benno Schulenberg <bensberg@justemail.net>
|
2016-02-23 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/prompt.c (do_statusbar_output, do_statusbar_delete):
|
* src/prompt.c (do_statusbar_output, do_statusbar_delete):
|
||||||
Rename a variable, for contrast and correctness.
|
Rename a variable, for contrast and correctness.
|
||||||
|
|
|
@ -322,7 +322,7 @@ char *do_browser(char *path, DIR *dir)
|
||||||
/* We've successfully opened the parent directory,
|
/* We've successfully opened the parent directory,
|
||||||
* save the current directory in prev_dir, so that
|
* save the current directory in prev_dir, so that
|
||||||
* we can easily return to it by hitting Enter. */
|
* we can easily return to it by hitting Enter. */
|
||||||
prev_dir = mallocstrcpy(NULL, striponedir(filelist[selected]));
|
prev_dir = striponedir(filelist[selected]);
|
||||||
|
|
||||||
dir = opendir(filelist[selected]);
|
dir = opendir(filelist[selected]);
|
||||||
if (dir == NULL) {
|
if (dir == NULL) {
|
||||||
|
@ -330,6 +330,8 @@ char *do_browser(char *path, DIR *dir)
|
||||||
* Complain. */
|
* Complain. */
|
||||||
statusbar(_("Error reading %s: %s"),
|
statusbar(_("Error reading %s: %s"),
|
||||||
filelist[selected], strerror(errno));
|
filelist[selected], strerror(errno));
|
||||||
|
free(prev_dir);
|
||||||
|
prev_dir = NULL;
|
||||||
beep();
|
beep();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue