diff src/main.c @ 2770:25672ad7f377 v7.3.161

updated for version 7.3.161 Problem: Items on the stack may be too big. Solution: Make items static or allocate them.
author Bram Moolenaar <bram@vim.org>
date Mon, 11 Apr 2011 21:35:11 +0200
parents e0a90042318d
children 8bd38abda314
line wrap: on
line diff
--- a/src/main.c
+++ b/src/main.c
@@ -3814,7 +3814,7 @@ build_drop_cmd(filec, filev, tabs, sendR
     int		i;
     char_u	*inicmd = NULL;
     char_u	*p;
-    char_u	cwd[MAXPATHL];
+    char_u	*cwd;
 
     if (filec > 0 && filev[0][0] == '+')
     {
@@ -3827,15 +3827,23 @@ build_drop_cmd(filec, filev, tabs, sendR
 	mainerr_arg_missing((char_u *)filev[-1]);
 
     /* Temporarily cd to the current directory to handle relative file names. */
-    if (mch_dirname(cwd, MAXPATHL) != OK)
+    cwd = alloc(MAXPATHL);
+    if (cwd == NULL)
 	return NULL;
-    if ((p = vim_strsave_escaped_ext(cwd,
+    if (mch_dirname(cwd, MAXPATHL) != OK)
+    {
+	vim_free(cwd);
+	return NULL;
+    }
+    p = vim_strsave_escaped_ext(cwd,
 #ifdef BACKSLASH_IN_FILENAME
 		    "",  /* rem_backslash() will tell what chars to escape */
 #else
 		    PATH_ESC_CHARS,
 #endif
-		    '\\', TRUE)) == NULL)
+		    '\\', TRUE);
+    vim_free(cwd);
+    if (p == NULL)
 	return NULL;
     ga_init2(&ga, 1, 100);
     ga_concat(&ga, (char_u *)"<C-\\><C-N>:cd ");