diff --git a/ChangeLog b/ChangeLog
index 5cbbfd1561d5302766ba498283c2138df7ed168f..db4eece6b2a16f180d4c803f16a069cf775077b5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,9 @@
 	* src/nano.c (main): Allow the user full control over the values of
 	MALLOC_CHECK_ and MALLOC_PERTURB_; nano shouldn't override these.
 	This reverts r5344 from August 6.
+	* src/nano.c (alloc_multidata_if_needed): When allocating a new
+	multidata array, initialize the array.  Problem was betrayed by
+	using MALLOC_PERTURB_, and was located with valgrind.
 
 2015-11-26  Benno Schulenberg  <bensberg@justemail.net>
 	* src/text.c (do_redo): Not just the undoing, also the redoing of a
diff --git a/src/nano.c b/src/nano.c
index 7401a4116e960f965ea0e08dfb7323a8f350ed57..963a1ec202d9a738e9a9ddb1d477b50be4eb8780 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -1849,8 +1849,14 @@ int do_mouse(void)
 #ifndef DISABLE_COLOR
 void alloc_multidata_if_needed(filestruct *fileptr)
 {
-    if (!fileptr->multidata)
+    int i;
+
+    if (fileptr->multidata == NULL) {
 	fileptr->multidata = (short *)nmalloc(openfile->syntax->nmultis * sizeof(short));
+
+	for (i = 0; i < openfile->syntax->nmultis; i++)
+	    fileptr->multidata[i] = -1;
+    }
 }
 
 /* Precalculate the multi-line start and end regex info so we can