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 {