runtime: fix memory leaks
This commit is contained in:
@@ -241,7 +241,7 @@ static enum bshell_status eval_instruction(
|
||||
pool_value = bshell_scriptblock_get_pool_value(
|
||||
scope->s_block,
|
||||
arg,
|
||||
FX_TYPE_CSTR);
|
||||
FX_TYPE_STRING);
|
||||
if (!pool_value) {
|
||||
fprintf(stderr, "RUNTIME: invalid stlocal operand\n");
|
||||
return BSHELL_ERR_BAD_SYNTAX;
|
||||
@@ -253,7 +253,7 @@ static enum bshell_status eval_instruction(
|
||||
var = bshell_runtime_define_var(rt, s);
|
||||
}
|
||||
|
||||
bshell_variable_set_value(var, &x);
|
||||
bshell_variable_set_value(var, x);
|
||||
bshell_runtime_scope_push_value(scope, &x);
|
||||
fx_value_unset(&x);
|
||||
break;
|
||||
@@ -314,7 +314,8 @@ static enum bshell_status eval_instruction(
|
||||
bshell_cmdcall *result = bshell_cmdcall_create();
|
||||
|
||||
while (arg > 0) {
|
||||
fx_value cmd_arg = bshell_runtime_scope_pop_value(scope);
|
||||
fx_value cmd_arg
|
||||
= bshell_runtime_scope_pop_value(scope);
|
||||
bshell_cmdcall_push_arg(result, cmd_arg);
|
||||
fx_value_unset(&cmd_arg);
|
||||
arg--;
|
||||
@@ -322,6 +323,7 @@ static enum bshell_status eval_instruction(
|
||||
|
||||
bstatus = bshell_cmdcall_resolve(result, rt);
|
||||
if (bstatus != BSHELL_SUCCESS) {
|
||||
bshell_cmdcall_unref(result);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -422,7 +424,9 @@ fx_value bshell_runtime_eval_global(
|
||||
{
|
||||
enum bshell_status status = BSHELL_SUCCESS;
|
||||
bshell_runtime_scope_set_block(rt->rt_global, block);
|
||||
return runtime_eval(rt);
|
||||
fx_value result = runtime_eval(rt);
|
||||
bshell_runtime_scope_set_block(rt->rt_global, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
fx_value bshell_runtime_eval_script(
|
||||
|
||||
Reference in New Issue
Block a user