Fix memory reallocation bug.
This commit is contained in:
parent
3810c83600
commit
a70b23a405
54
editors/nano/patches/patch-files_c
Normal file
54
editors/nano/patches/patch-files_c
Normal file
@ -0,0 +1,54 @@
|
||||
$OpenBSD: patch-files_c,v 1.1 2003/10/26 16:05:29 naddy Exp $
|
||||
--- files.c.orig 2003-08-06 05:15:15.000000000 +0200
|
||||
+++ files.c 2003-10-26 16:58:31.000000000 +0100
|
||||
@@ -1701,16 +1701,17 @@ int do_writeout(const char *path, int ex
|
||||
#ifdef NANO_EXTRA
|
||||
static int did_cred = 0;
|
||||
#endif
|
||||
+ static char *writepath = NULL;
|
||||
|
||||
#if !defined(DISABLE_BROWSER) || (!defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION))
|
||||
currshortcut = writefile_list;
|
||||
#endif
|
||||
|
||||
- answer = mallocstrcpy(answer, path);
|
||||
+ writepath = mallocstrcpy(writepath, path);
|
||||
|
||||
if (exiting && ISSET(TEMP_OPT)) {
|
||||
if (filename[0] != '\0') {
|
||||
- i = write_file(answer, 0, 0, 0);
|
||||
+ i = write_file(writepath, 0, 0, 0);
|
||||
display_main_list();
|
||||
return i;
|
||||
} else {
|
||||
@@ -1751,24 +1752,24 @@ int do_writeout(const char *path, int ex
|
||||
"%s%s%s", _("Write Selection to File"), formatstr, backupstr);
|
||||
} else {
|
||||
if (append == 2)
|
||||
- i = statusq(1, writefile_list, answer, 0,
|
||||
+ i = statusq(1, writefile_list, writepath, 0,
|
||||
"%s%s%s", _("File Name to Prepend to"), formatstr, backupstr);
|
||||
else if (append == 1)
|
||||
- i = statusq(1, writefile_list, answer, 0,
|
||||
+ i = statusq(1, writefile_list, writepath, 0,
|
||||
"%s%s%s", _("File Name to Append to"), formatstr, backupstr);
|
||||
else
|
||||
- i = statusq(1, writefile_list, answer, 0,
|
||||
+ i = statusq(1, writefile_list, writepath, 0,
|
||||
"%s%s%s", _("File Name to Write"), formatstr, backupstr);
|
||||
}
|
||||
#else
|
||||
if (append == 2)
|
||||
- i = statusq(1, writefile_list, answer,
|
||||
+ i = statusq(1, writefile_list, writepath,
|
||||
"%s", _("File Name to Prepend to"));
|
||||
else if (append == 1)
|
||||
- i = statusq(1, writefile_list, answer,
|
||||
+ i = statusq(1, writefile_list, writepath,
|
||||
"%s", _("File Name to Append to"));
|
||||
else
|
||||
- i = statusq(1, writefile_list, answer,
|
||||
+ i = statusq(1, writefile_list, writepath,
|
||||
"%s", _("File Name to Write"));
|
||||
#endif /* !NANO_SMALL */
|
||||
|
17
editors/nano/patches/patch-search_c
Normal file
17
editors/nano/patches/patch-search_c
Normal file
@ -0,0 +1,17 @@
|
||||
$OpenBSD: patch-search_c,v 1.1 2003/10/26 16:05:29 naddy Exp $
|
||||
--- search.c.orig 2003-07-03 03:18:06.000000000 +0200
|
||||
+++ search.c 2003-10-26 16:58:31.000000000 +0100
|
||||
@@ -769,8 +769,12 @@ int do_replace(void)
|
||||
|
||||
int do_gotoline(int line, int save_pos)
|
||||
{
|
||||
+ static char *linestr = NULL;
|
||||
+
|
||||
+ linestr = mallocstrcpy(linestr, answer);
|
||||
+
|
||||
if (line <= 0) { /* Ask for it */
|
||||
- int st = statusq(FALSE, goto_list, line != 0 ? answer : "",
|
||||
+ int st = statusq(FALSE, goto_list, line != 0 ? linestr : "",
|
||||
#ifndef NANO_SMALL
|
||||
NULL,
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user