Gabriel Ivăncescu : vbscript: Change release_dynamic_vars to release a single variable.
Alexandre Julliard
julliard at winehq.org
Mon Nov 11 16:20:23 CST 2019
Module: wine
Branch: master
Commit: f9613711aaf29c3a43f008189085ba261ac30807
URL: https://source.winehq.org/git/wine.git/?a=commit;h=f9613711aaf29c3a43f008189085ba261ac30807
Author: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Date: Mon Nov 11 14:34:25 2019 +0200
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 at gmail.com>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/vbscript/interp.c | 16 ++++++++--------
dlls/vbscript/vbscript.c | 2 +-
dlls/vbscript/vbscript.h | 2 +-
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c
index cf21601ecc..d15a1b5329 100644
--- a/dlls/vbscript/interp.c
+++ b/dlls/vbscript/interp.c
@@ -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;
- }
+ VariantClear(&var->v);
+ if(var->array)
+ SafeArrayDestroy(var->array);
}
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);
diff --git a/dlls/vbscript/vbscript.c b/dlls/vbscript/vbscript.c
index 85107e7e84..fdade9f13a 100644
--- a/dlls/vbscript/vbscript.c
+++ b/dlls/vbscript/vbscript.c
@@ -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);
diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h
index a59f341b10..1cc36fd3fd 100644
--- a/dlls/vbscript/vbscript.h
+++ b/dlls/vbscript/vbscript.h
@@ -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;
More information about the wine-cvs
mailing list