vbscript: Change release_dynamic_vars to release a single variable.

We need to free them while iterating an array as well as a linked list.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Gabriel Ivăncescu 2019-11-11 14:34:25 +02:00 committed by Alexandre Julliard
parent b7eb693e7f
commit f9613711aa
3 changed files with 10 additions and 10 deletions

View File

@ -2243,22 +2243,22 @@ OP_LIST
#undef X
};
void release_dynamic_vars(dynamic_var_t *var)
void release_dynamic_var(dynamic_var_t *var)
{
while(var) {
VariantClear(&var->v);
if(var->array)
SafeArrayDestroy(var->array);
var = var->next;
}
}
static void release_exec(exec_ctx_t *ctx)
{
dynamic_var_t *var;
unsigned i;
VariantClear(&ctx->ret_val);
release_dynamic_vars(ctx->dynamic_vars);
for(var = ctx->dynamic_vars; var; var = var->next)
release_dynamic_var(var);
if(ctx->vbthis)
IDispatchEx_Release(&ctx->vbthis->IDispatchEx_iface);

View File

@ -217,7 +217,7 @@ static void release_script(script_ctx_t *ctx)
clear_ei(&ctx->ei);
for(i = 0; i < ctx->global_vars_cnt; i++)
VariantClear(&ctx->global_vars[i]->v);
release_dynamic_var(ctx->global_vars[i]);
heap_free(ctx->global_vars);
heap_free(ctx->global_funcs);

View File

@ -361,7 +361,7 @@ void release_vbscode(vbscode_t*) DECLSPEC_HIDDEN;
HRESULT compile_script(script_ctx_t*,const WCHAR*,const WCHAR*,DWORD,vbscode_t**) DECLSPEC_HIDDEN;
HRESULT compile_procedure(script_ctx_t*,const WCHAR*,const WCHAR*,DWORD,class_desc_t**) DECLSPEC_HIDDEN;
HRESULT exec_script(script_ctx_t*,BOOL,function_t*,vbdisp_t*,DISPPARAMS*,VARIANT*) DECLSPEC_HIDDEN;
void release_dynamic_vars(dynamic_var_t*) DECLSPEC_HIDDEN;
void release_dynamic_var(dynamic_var_t*) DECLSPEC_HIDDEN;
IDispatch *lookup_named_item(script_ctx_t*,const WCHAR*,unsigned) DECLSPEC_HIDDEN;
void clear_ei(EXCEPINFO*) DECLSPEC_HIDDEN;
HRESULT report_script_error(script_ctx_t*) DECLSPEC_HIDDEN;