diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c index 08bf7106bfd..f03655778da 100644 --- a/dlls/vbscript/interp.c +++ b/dlls/vbscript/interp.c @@ -1561,11 +1561,20 @@ OP_LIST #undef X }; +void release_dynamic_vars(dynamic_var_t *var) +{ + while(var) { + VariantClear(&var->v); + var = var->next; + } +} + static void release_exec(exec_ctx_t *ctx) { unsigned i; VariantClear(&ctx->ret_val); + release_dynamic_vars(ctx->dynamic_vars); if(ctx->this_obj) IDispatch_Release(ctx->this_obj); diff --git a/dlls/vbscript/vbscript.c b/dlls/vbscript/vbscript.c index ffaa63e9658..af037bd8de6 100644 --- a/dlls/vbscript/vbscript.c +++ b/dlls/vbscript/vbscript.c @@ -114,6 +114,9 @@ static void release_script(script_ctx_t *ctx) { collect_objects(ctx); + release_dynamic_vars(ctx->global_vars); + ctx->global_vars = NULL; + while(!list_empty(&ctx->named_items)) { named_item_t *iter = LIST_ENTRY(list_head(&ctx->named_items), named_item_t, entry); diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h index 9e18f47b877..890c7c75ee8 100644 --- a/dlls/vbscript/vbscript.h +++ b/dlls/vbscript/vbscript.h @@ -309,6 +309,7 @@ struct _vbscode_t { void release_vbscode(vbscode_t*) DECLSPEC_HIDDEN; HRESULT compile_script(script_ctx_t*,const WCHAR*,vbscode_t**) DECLSPEC_HIDDEN; HRESULT exec_script(script_ctx_t*,function_t*,IDispatch*,DISPPARAMS*,VARIANT*) DECLSPEC_HIDDEN; +void release_dynamic_vars(dynamic_var_t*) DECLSPEC_HIDDEN; #define TID_LIST \ XDIID(ErrObj) \