From 1cf9deb6032b00e4ade09b89b5ba03f8833c0407 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Sun, 12 Apr 2015 11:15:57 +0000
Subject: [PATCH] Using mallocstrcpy() in a correct manner and not letting it
 free an unrelated string.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5193 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog    | 2 ++
 src/rcfile.c | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 448e93a6..cb9127c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,8 @@
 	first_file() and last_file().  Also unbind some other useless keys.
 	* src/browser.c (filesearch_init): Remove an unused variable, and
 	adjust the introductory comment for the recently tweaked logic.
+	* src/rcfile.c (parse_linter, parse_formatter): Use mallocstrcpy()
+	in a correct manner; don't let it free an unrelated string.
 
 2015-04-11  Benno Schulenberg  <bensberg@justemail.net>
 	* src/search.c (do_replace_loop): Do not split off the marked region
diff --git a/src/rcfile.c b/src/rcfile.c
index d8baeca0..581456de 100644
--- a/src/rcfile.c
+++ b/src/rcfile.c
@@ -992,7 +992,7 @@ void parse_linter(char *ptr)
     if (!strcmp(ptr, "\"\""))
 	endsyntax->linter = NULL;
     else
-	endsyntax->linter = mallocstrcpy(syntaxes->linter, ptr);
+	endsyntax->linter = mallocstrcpy(NULL, ptr);
 }
 
 #ifndef DISABLE_SPELLER
@@ -1019,7 +1019,7 @@ void parse_formatter(char *ptr)
     if (!strcmp(ptr, "\"\""))
 	endsyntax->formatter = NULL;
     else
-	endsyntax->formatter = mallocstrcpy(syntaxes->formatter, ptr);
+	endsyntax->formatter = mallocstrcpy(NULL, ptr);
 }
 #endif /* !DISABLE_SPELLER */
 #endif /* !DISABLE_COLOR */
-- 
GitLab