Puetz Kevin A : jscript: Fix some memory problems in disp_call_value.
Alexandre Julliard
julliard at winehq.org
Thu Jul 23 16:36:56 CDT 2020
Module: wine
Branch: master
Commit: 616f5a5d4b05ab7278658549d15f5ff50b2c824f
URL: https://source.winehq.org/git/wine.git/?a=commit;h=616f5a5d4b05ab7278658549d15f5ff50b2c824f
Author: Puetz Kevin A <PuetzKevinA at JohnDeere.com>
Date: Thu Jul 23 04:58:37 2020 +0000
jscript: Fix some memory problems in disp_call_value.
Signed-off-by: Kevin Puetz <PuetzKevinA at JohnDeere.com>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/jscript/dispex.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c
index d9097c47dd..2ba706252b 100644
--- a/dlls/jscript/dispex.c
+++ b/dlls/jscript/dispex.c
@@ -2095,12 +2095,14 @@ HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, W
dp.rgdispidNamedArgs = NULL;
}
- if(argc > ARRAY_SIZE(buf) && !(args = heap_alloc(argc * sizeof(VARIANT))))
+ if(dp.cArgs > ARRAY_SIZE(buf) && !(args = heap_alloc(dp.cArgs * sizeof(VARIANT))))
return E_OUTOFMEMORY;
dp.rgvarg = args;
- V_VT(dp.rgvarg) = VT_DISPATCH;
- V_DISPATCH(dp.rgvarg) = jsthis;
+ if(jsthis) {
+ V_VT(dp.rgvarg) = VT_DISPATCH;
+ V_DISPATCH(dp.rgvarg) = jsthis;
+ }
for(i=0; SUCCEEDED(hres) && i < argc; i++)
hres = jsval_to_variant(argv[i], dp.rgvarg+dp.cArgs-i-1);
@@ -2110,7 +2112,7 @@ HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, W
hres = disp_invoke(ctx, disp, DISPID_VALUE, flags, &dp, r ? &retv : NULL);
}
- for(i = 0; i < argc&&0; i++)
+ for(i = 0; i < argc; i++)
VariantClear(dp.rgvarg + dp.cArgs - i - 1);
if(args != buf)
heap_free(args);
More information about the wine-cvs
mailing list