completion: fix segfault with ignorecase+infercase (#6452)

Helped-by: Matthew Malcomson <hardenedapple@gmail.com>

Closes #6451
This commit is contained in:
Justin M. Keyes
2017-04-06 21:35:03 +02:00
committed by GitHub
parent c501d7c432
commit 30e1cda8ac
2 changed files with 18 additions and 2 deletions

View File

@@ -2109,7 +2109,7 @@ int ins_compl_add_infercase(char_u *str, int len, int icase, char_u *fname, int
xfree(wca);
return ins_compl_add(IObuff, len, icase, fname, NULL, true, dir, flags,
return ins_compl_add(IObuff, len, icase, fname, NULL, false, dir, flags,
false);
}
return ins_compl_add(str, len, icase, fname, NULL, false, dir, flags, false);
@@ -2146,7 +2146,7 @@ static int ins_compl_add(char_u *const str, int len,
os_breakcheck();
#define FREE_CPTEXT(cptext, cptext_allocated) \
do { \
if (cptext_allocated) { \
if (cptext != NULL && cptext_allocated) { \
for (size_t i = 0; i < CPT_COUNT; i++) { \
xfree(cptext[i]); \
} \