Commit 6f0e215f authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

vbscript: Properly release global variables.

parent 84d5a396
......@@ -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);
......
......@@ -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);
......
......@@ -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) \
......
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