vim-patch:8.2.0171: fix use of uninitialized buffer #11786

Problem:    Coverity warning for using uninitialized buffer.
Solution:   Check the skip flag.
9a5e5a3e33
This commit is contained in:
Jan Edmund Lazo
2020-01-29 02:02:11 -05:00
committed by GitHub
parent 01ff9db633
commit 0b49cb67f2

View File

@@ -22132,11 +22132,12 @@ ret_free:
static char_u * static char_u *
trans_function_name( trans_function_name(
char_u **pp, char_u **pp,
int skip, // only find the end, don't evaluate bool skip, // only find the end, don't evaluate
int flags, int flags,
funcdict_T *fdp, // return: info about dictionary used funcdict_T *fdp, // return: info about dictionary used
partial_T **partial // return: partial of a FuncRef partial_T **partial // return: partial of a FuncRef
) )
FUNC_ATTR_NONNULL_ARG(1)
{ {
char_u *name = NULL; char_u *name = NULL;
const char_u *start; const char_u *start;
@@ -22323,7 +22324,7 @@ trans_function_name(
} }
name = xmalloc(len + lead + 1); name = xmalloc(len + lead + 1);
if (lead > 0){ if (!skip && lead > 0) {
name[0] = K_SPECIAL; name[0] = K_SPECIAL;
name[1] = KS_EXTRA; name[1] = KS_EXTRA;
name[2] = (int)KE_SNR; name[2] = (int)KE_SNR;