From 8c1526a865280be7d713b21a1cca6c8e4c95c95a Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 28 Mar 2016 17:50:18 +0200 Subject: [PATCH] jscript: Keep reference to bytecode in call_frame_t. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/jscript/engine.c | 3 ++- dlls/jscript/engine.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c index 802e408b7ae..b14ec2d3ef1 100644 --- a/dlls/jscript/engine.c +++ b/dlls/jscript/engine.c @@ -2388,6 +2388,7 @@ static void release_call_frame(call_frame_t *frame) if(frame->scope) scope_release(frame->scope); jsval_release(frame->ret); + release_bytecode(frame->bytecode); heap_free(frame); } @@ -2579,7 +2580,7 @@ HRESULT exec_source(script_ctx_t *ctx, DWORD flags, bytecode_t *bytecode, functi if(!frame) return E_OUTOFMEMORY; - frame->bytecode = bytecode; + frame->bytecode = bytecode_addref(bytecode); frame->function = function; frame->ip = function->instr_off; frame->stack_base = ctx->stack_top; diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h index 4915b60c188..4b3bba2afc3 100644 --- a/dlls/jscript/engine.h +++ b/dlls/jscript/engine.h @@ -168,9 +168,10 @@ typedef struct _bytecode_t { HRESULT compile_script(script_ctx_t*,const WCHAR*,const WCHAR*,const WCHAR*,BOOL,BOOL,bytecode_t**) DECLSPEC_HIDDEN; void release_bytecode(bytecode_t*) DECLSPEC_HIDDEN; -static inline void bytecode_addref(bytecode_t *code) +static inline bytecode_t *bytecode_addref(bytecode_t *code) { code->ref++; + return code; } typedef struct _scope_chain_t {