Commit bb80eaa4 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

vbscript: Don't leak memory in parser.

parent 5b8cde66
......@@ -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;
......@@ -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);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment