diff options
author | Bram Moolenaar <Bram@vim.org> | 2010-08-03 22:21:00 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2010-08-03 22:21:00 +0200 |
commit | 7f0f621c4c85581cbc9f8ebdb13b9cc0dc2537db (patch) | |
tree | 3ba83e238f524455e2600ddecbca2abcbedaca3e /src | |
parent | 57adda1e901c0744b0e4d3e3db55c301081db4f8 (diff) | |
download | vim-git-7f0f621c4c85581cbc9f8ebdb13b9cc0dc2537db.tar.gz |
Fix crash in :find completion. (Nazri Ramliy)
Diffstat (limited to 'src')
-rw-r--r-- | src/misc1.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/misc1.c b/src/misc1.c index bcf4ce7f8..b0f7e91fc 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -9587,7 +9587,7 @@ expand_in_path(gap, pattern, flags) char_u *paths = NULL; # endif - if ((curdir = alloc((int)(MAXPATHL))) == NULL) + if ((curdir = alloc((unsigned)MAXPATHL)) == NULL) return 0; mch_dirname(curdir, MAXPATHL); @@ -9595,6 +9595,8 @@ expand_in_path(gap, pattern, flags) vim_free(curdir); path_list = (char_u **)(path_ga.ga_data); # ifdef WIN3264 + if ((file_pattern = alloc((unsigned)MAXPATHL)) == NULL) + return 0; for (i = 0; i < path_ga.ga_len; i++) { if (STRLEN(path_list[i]) + STRLEN(pattern) + 2 > MAXPATHL) @@ -9604,12 +9606,13 @@ expand_in_path(gap, pattern, flags) STRCAT(file_pattern, pattern); mch_expandpath(gap, file_pattern, EW_DIR|EW_ADDSLASH|EW_FILE); } + vim_free(file_pattern); # else for (i = 0; i < path_ga.ga_len; i++) { if (paths == NULL) { - if ((paths = alloc((int)(STRLEN(path_list[i]) + 1))) == NULL) + if ((paths = alloc((unsigned)(STRLEN(path_list[i]) + 1))) == NULL) return 0; STRCPY(paths, path_list[i]); } |