Module: wine Branch: master Commit: d7edf0162dd7c5d1ed77312ab065b528da6fc716 URL: http://source.winehq.org/git/wine.git/?a=commit;h=d7edf0162dd7c5d1ed77312ab0...
Author: Jacek Caban jacek@codeweavers.com Date: Tue Oct 27 22:47:20 2009 +0100
jscript: Store a copy of code in parser_ctx_t.
---
dlls/jscript/engine.h | 4 ++-- dlls/jscript/parser.y | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h index 0cd4c40..7dcfc13 100644 --- a/dlls/jscript/engine.h +++ b/dlls/jscript/engine.h @@ -43,9 +43,9 @@ typedef struct _func_stack { typedef struct _parser_ctx_t { LONG ref;
- const WCHAR *ptr; - const WCHAR *begin; + WCHAR *begin; const WCHAR *end; + const WCHAR *ptr;
script_ctx_t *script; source_elements_t *source; diff --git a/dlls/jscript/parser.y b/dlls/jscript/parser.y index 9cae524..0683ab6 100644 --- a/dlls/jscript/parser.y +++ b/dlls/jscript/parser.y @@ -1594,6 +1594,7 @@ void parser_release(parser_ctx_t *ctx) if(--ctx->ref) return;
+ heap_free(ctx->begin); jsheap_free(&ctx->heap); heap_free(ctx); } @@ -1615,8 +1616,14 @@ HRESULT script_parse(script_ctx_t *ctx, const WCHAR *code, const WCHAR *delimite parser_ctx->hres = JSCRIPT_ERROR|IDS_SYNTAX_ERROR; parser_ctx->is_html = delimiter && !strcmpiW(delimiter, html_tagW);
- parser_ctx->begin = parser_ctx->ptr = code; - parser_ctx->end = code + strlenW(code); + parser_ctx->begin = heap_strdupW(code); + if(!parser_ctx->begin) { + heap_free(parser_ctx); + return E_OUTOFMEMORY; + } + + parser_ctx->ptr = parser_ctx->begin; + parser_ctx->end = parser_ctx->begin + strlenW(parser_ctx->begin);
script_addref(ctx); parser_ctx->script = ctx;