mirror of
https://github.com/neovim/neovim.git
synced 2025-09-10 21:38:19 +00:00
nvim_eval: fix memory leak
This commit is contained in:
@@ -290,14 +290,16 @@ Object nvim_eval(String expr, Error *err)
|
|||||||
try_start();
|
try_start();
|
||||||
|
|
||||||
typval_T rettv;
|
typval_T rettv;
|
||||||
if (eval0((char_u *)expr.data, &rettv, NULL, true) == FAIL) {
|
int ok = eval0((char_u *)expr.data, &rettv, NULL, true);
|
||||||
// This generic error should be overwritten by try_end() since #8371.
|
|
||||||
api_set_error(err, kErrorTypeException, "Failed to evaluate expression");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!try_end(err)) {
|
if (!try_end(err)) {
|
||||||
|
if (ok == FAIL) {
|
||||||
|
// Should never happen, try_end() should get the error. #8371
|
||||||
|
api_set_error(err, kErrorTypeException, "Failed to evaluate expression");
|
||||||
|
} else {
|
||||||
rv = vim_to_object(&rettv);
|
rv = vim_to_object(&rettv);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tv_clear(&rettv);
|
tv_clear(&rettv);
|
||||||
msg_list = saved_msg_list; // Restore the exception context.
|
msg_list = saved_msg_list; // Restore the exception context.
|
||||||
|
Reference in New Issue
Block a user