]> granicus.if.org Git - vim/commitdiff
patch 8.2.2751: Coverity warns for using NULL pointer v8.2.2751
authorBram Moolenaar <Bram@vim.org>
Sat, 10 Apr 2021 19:38:38 +0000 (21:38 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 10 Apr 2021 19:38:38 +0000 (21:38 +0200)
Problem:    Coverity warns for using NULL pointer.
Solution:   Check for NULL in calling function.

src/userfunc.c
src/version.c

index 5221126076b1380dc71f70cb5b0bb21131d6d26c..54335d41f9b66cc43739ed035785aa0fc8382512 100644 (file)
@@ -973,8 +973,7 @@ lambda_function_body(
        garray_T    *default_args,
        char_u      *ret_type)
 {
-    int                evaluate = evalarg != NULL
-                                     && (evalarg->eval_flags & EVAL_EVALUATE);
+    int                evaluate = (evalarg->eval_flags & EVAL_EVALUATE);
     ufunc_T    *ufunc = NULL;
     exarg_T    eap;
     garray_T   newlines;
@@ -1180,6 +1179,9 @@ get_lambda_tv(
     // Recognize "{" as the start of a function body.
     if (equal_arrow && **arg == '{')
     {
+       if (evalarg == NULL)
+           // cannot happen?
+           goto theend;
        if (lambda_function_body(arg, rettv, evalarg, pnewargs,
                           types_optional ? &argtypes : NULL, varargs,
                           &default_args, ret_type) == FAIL)
index ed2237532daacd788f0ecb0d47fe7f690f429caf..2e0d3132bfbd152aeca632edfd71bb03e6161b66 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2751,
 /**/
     2750,
 /**/