vbscript: Properly release global variables.

This commit is contained in:
Jacek Caban 2011-10-14 16:22:18 +02:00 committed by Alexandre Julliard
parent 84d5a39659
commit 6f0e215fb5
3 changed files with 13 additions and 0 deletions

View File

@ -1561,11 +1561,20 @@ OP_LIST
#undef X #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) static void release_exec(exec_ctx_t *ctx)
{ {
unsigned i; unsigned i;
VariantClear(&ctx->ret_val); VariantClear(&ctx->ret_val);
release_dynamic_vars(ctx->dynamic_vars);
if(ctx->this_obj) if(ctx->this_obj)
IDispatch_Release(ctx->this_obj); IDispatch_Release(ctx->this_obj);

View File

@ -114,6 +114,9 @@ static void release_script(script_ctx_t *ctx)
{ {
collect_objects(ctx); collect_objects(ctx);
release_dynamic_vars(ctx->global_vars);
ctx->global_vars = NULL;
while(!list_empty(&ctx->named_items)) { while(!list_empty(&ctx->named_items)) {
named_item_t *iter = LIST_ENTRY(list_head(&ctx->named_items), named_item_t, entry); named_item_t *iter = LIST_ENTRY(list_head(&ctx->named_items), named_item_t, entry);

View File

@ -309,6 +309,7 @@ struct _vbscode_t {
void release_vbscode(vbscode_t*) DECLSPEC_HIDDEN; void release_vbscode(vbscode_t*) DECLSPEC_HIDDEN;
HRESULT compile_script(script_ctx_t*,const WCHAR*,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; 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 \ #define TID_LIST \
XDIID(ErrObj) \ XDIID(ErrObj) \