patch 8.1.2107: various memory leaks reported by asan
Problem: Various memory leaks reported by asan.
Solution: Free the memory. (Ozaki Kiichi, closes #5003)
diff --git a/src/eval.c b/src/eval.c
index 680ca1a..954e07f 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2914,9 +2914,17 @@
semsg(_(e_missingparen), "lambda");
}
clear_tv(rettv);
- return FAIL;
+ ret = FAIL;
}
- return call_func_rettv(arg, rettv, evaluate, NULL, &base);
+ else
+ ret = call_func_rettv(arg, rettv, evaluate, NULL, &base);
+
+ // Clear the funcref afterwards, so that deleting it while
+ // evaluating the arguments is possible (see test55).
+ if (evaluate)
+ clear_tv(&base);
+
+ return ret;
}
/*