vbscript: Don't leak memory in parser.
This commit is contained in:
parent
5b8cde66f1
commit
bb80eaa492
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue