diff options
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c index 0527a918d..a296cd448 100644 --- a/src/main.c +++ b/src/main.c @@ -3814,7 +3814,7 @@ build_drop_cmd(filec, filev, tabs, sendReply) 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, sendReply) mainerr_arg_missing((char_u *)filev[-1]); /* Temporarily cd to the current directory to handle relative file names. */ + cwd = alloc(MAXPATHL); + if (cwd == NULL) + return NULL; if (mch_dirname(cwd, MAXPATHL) != OK) + { + vim_free(cwd); return NULL; - if ((p = vim_strsave_escaped_ext(cwd, + } + 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 "); |