Commit f9613711 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

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: 's avatarGabriel Ivăncescu <gabrielopcode@gmail.com> Signed-off-by: 's avatarJacek Caban <jacek@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent b7eb693e
......@@ -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);
......
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment