about summary refs log tree commit diff
path: root/Src/utils.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2009-03-03 22:11:37 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2009-03-03 22:11:37 +0000
commitd60f73f7081a327fc6d6b9f988c763ab7b228f74 (patch)
tree3f5abcbd88b93a5f9b87867cb071f087b3516ec2 /Src/utils.c
parenta3e73c8d05526b8c9d0735cfe747411567784a83 (diff)
downloadzsh-d60f73f7081a327fc6d6b9f988c763ab7b228f74.tar.gz
zsh-d60f73f7081a327fc6d6b9f988c763ab7b228f74.tar.xz
zsh-d60f73f7081a327fc6d6b9f988c763ab7b228f74.zip
26686: problem storing long $_ using VARARR()
Diffstat (limited to 'Src/utils.c')
-rw-r--r--Src/utils.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/Src/utils.c b/Src/utils.c
index fbe1eb223..7a983d48d 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -1340,9 +1340,13 @@ checkmailpath(char **s)
 		    fprintf(shout, "You have new mail.\n");
 		    fflush(shout);
 		} else {
-		    VARARR(char, usav, underscoreused);
+		    char *usav;
+		    int uusav = underscoreused;
 
-		    memcpy(usav, underscore, underscoreused);
+		    usav = zalloc(underscoreused);
+
+		    if (usav)
+			memcpy(usav, underscore, underscoreused);
 
 		    setunderscore(*s);
 
@@ -1353,7 +1357,10 @@ checkmailpath(char **s)
 			fputc('\n', shout);
 			fflush(shout);
 		    }
-		    setunderscore(usav);
+		    if (usav) {
+			setunderscore(usav);
+			zfree(usav, uusav);
+		    }
 		}
 	    }
 	    if (isset(MAILWARNING) && st.st_atime > st.st_mtime &&