diff --git a/dlls/vbscript/parse.h b/dlls/vbscript/parse.h index 56b3e1b6be3..0e69921423b 100644 --- a/dlls/vbscript/parse.h +++ b/dlls/vbscript/parse.h @@ -87,8 +87,11 @@ typedef struct { statement_t *stats; statement_t *stats_tail; + + vbsheap_t heap; } parser_ctx_t; HRESULT parse_script(parser_ctx_t*,const WCHAR*) DECLSPEC_HIDDEN; +void parser_release(parser_ctx_t*) DECLSPEC_HIDDEN; int parser_lex(void*,parser_ctx_t*) DECLSPEC_HIDDEN; void *parser_alloc(parser_ctx_t*,size_t) DECLSPEC_HIDDEN; diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y index c1c7e61f559..607fcb66dfd 100644 --- a/dlls/vbscript/parser.y +++ b/dlls/vbscript/parser.y @@ -280,8 +280,7 @@ void *parser_alloc(parser_ctx_t *ctx, size_t size) { void *ret; - /* FIXME: leaks! */ - ret = heap_alloc(size); + ret = vbsheap_alloc(&ctx->heap, size); if(!ret) ctx->hres = E_OUTOFMEMORY; return ret; @@ -292,6 +291,8 @@ HRESULT parse_script(parser_ctx_t *ctx, const WCHAR *code) ctx->code = ctx->ptr = code; ctx->end = ctx->code + strlenW(ctx->code); + vbsheap_init(&ctx->heap); + ctx->parse_complete = FALSE; ctx->hres = S_OK; @@ -311,3 +312,8 @@ HRESULT parse_script(parser_ctx_t *ctx, const WCHAR *code) return S_OK; } + +void parser_release(parser_ctx_t *ctx) +{ + vbsheap_free(&ctx->heap); +}