Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
ae73e09a
Commit
ae73e09a
authored
Nov 21, 2022
by
Gabriel Ivăncescu
Committed by
Alexandre Julliard
Nov 21, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Use CRT allocation functions.
Signed-off-by:
Gabriel Ivăncescu
<
gabrielopcode@gmail.com
>
parent
a08eb896
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
163 additions
and
164 deletions
+163
-164
array.c
dlls/jscript/array.c
+9
-9
bool.c
dlls/jscript/bool.c
+2
-2
compile.c
dlls/jscript/compile.c
+20
-20
date.c
dlls/jscript/date.c
+8
-8
engine.c
dlls/jscript/engine.c
+9
-9
enumerator.c
dlls/jscript/enumerator.c
+3
-3
error.c
dlls/jscript/error.c
+2
-2
function.c
dlls/jscript/function.c
+17
-17
jscript.c
dlls/jscript/jscript.c
+1
-1
jscript.h
dlls/jscript/jscript.h
+0
-1
json.c
dlls/jscript/json.c
+13
-13
jsregexp.c
dlls/jscript/jsregexp.c
+9
-9
jsstr.c
dlls/jscript/jsstr.c
+5
-5
jsutils.c
dlls/jscript/jsutils.c
+13
-13
lex.c
dlls/jscript/lex.c
+4
-4
math.c
dlls/jscript/math.c
+2
-2
number.c
dlls/jscript/number.c
+2
-2
object.c
dlls/jscript/object.c
+3
-3
parser.y
dlls/jscript/parser.y
+2
-2
regexp.c
dlls/jscript/regexp.c
+15
-15
regexp.h
dlls/jscript/regexp.h
+1
-1
set.c
dlls/jscript/set.c
+6
-6
string.c
dlls/jscript/string.c
+11
-11
vbarray.c
dlls/jscript/vbarray.c
+6
-6
No files found.
dlls/jscript/array.c
View file @
ae73e09a
...
@@ -242,7 +242,7 @@ static HRESULT array_join(script_ctx_t *ctx, jsdisp_t *array, DWORD length, cons
...
@@ -242,7 +242,7 @@ static HRESULT array_join(script_ctx_t *ctx, jsdisp_t *array, DWORD length, cons
return
S_OK
;
return
S_OK
;
}
}
str_tab
=
heap_alloc_zero
(
length
*
sizeof
(
*
str_tab
));
str_tab
=
calloc
(
length
,
sizeof
(
*
str_tab
));
if
(
!
str_tab
)
if
(
!
str_tab
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -304,7 +304,7 @@ static HRESULT array_join(script_ctx_t *ctx, jsdisp_t *array, DWORD length, cons
...
@@ -304,7 +304,7 @@ static HRESULT array_join(script_ctx_t *ctx, jsdisp_t *array, DWORD length, cons
if
(
str_tab
[
i
])
if
(
str_tab
[
i
])
jsstr_release
(
str_tab
[
i
]);
jsstr_release
(
str_tab
[
i
]);
}
}
heap_
free
(
str_tab
);
free
(
str_tab
);
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
...
@@ -720,7 +720,7 @@ static HRESULT Array_sort(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned
...
@@ -720,7 +720,7 @@ static HRESULT Array_sort(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned
goto
done
;
goto
done
;
}
}
vtab
=
heap_alloc_zero
(
length
*
sizeof
(
*
vtab
));
vtab
=
calloc
(
length
,
sizeof
(
*
vtab
));
if
(
vtab
)
{
if
(
vtab
)
{
for
(
i
=
0
;
i
<
length
;
i
++
)
{
for
(
i
=
0
;
i
<
length
;
i
++
)
{
hres
=
jsdisp_get_idx
(
jsthis
,
i
,
vtab
+
i
);
hres
=
jsdisp_get_idx
(
jsthis
,
i
,
vtab
+
i
);
...
@@ -737,7 +737,7 @@ static HRESULT Array_sort(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned
...
@@ -737,7 +737,7 @@ static HRESULT Array_sort(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned
}
}
if
(
SUCCEEDED
(
hres
))
{
if
(
SUCCEEDED
(
hres
))
{
sorttab
=
heap_
alloc
(
length
*
2
*
sizeof
(
*
sorttab
));
sorttab
=
m
alloc
(
length
*
2
*
sizeof
(
*
sorttab
));
if
(
!
sorttab
)
if
(
!
sorttab
)
hres
=
E_OUTOFMEMORY
;
hres
=
E_OUTOFMEMORY
;
}
}
...
@@ -809,9 +809,9 @@ static HRESULT Array_sort(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned
...
@@ -809,9 +809,9 @@ static HRESULT Array_sort(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned
if
(
vtab
)
{
if
(
vtab
)
{
for
(
i
=
0
;
i
<
length
;
i
++
)
for
(
i
=
0
;
i
<
length
;
i
++
)
jsval_release
(
vtab
[
i
]);
jsval_release
(
vtab
[
i
]);
heap_
free
(
vtab
);
free
(
vtab
);
}
}
heap_
free
(
sorttab
);
free
(
sorttab
);
if
(
cmp_func
)
if
(
cmp_func
)
jsdisp_release
(
cmp_func
);
jsdisp_release
(
cmp_func
);
...
@@ -1607,7 +1607,7 @@ done:
...
@@ -1607,7 +1607,7 @@ done:
static
void
Array_destructor
(
jsdisp_t
*
dispex
)
static
void
Array_destructor
(
jsdisp_t
*
dispex
)
{
{
heap_
free
(
dispex
);
free
(
dispex
);
}
}
static
void
Array_on_put
(
jsdisp_t
*
dispex
,
const
WCHAR
*
name
)
static
void
Array_on_put
(
jsdisp_t
*
dispex
,
const
WCHAR
*
name
)
...
@@ -1755,7 +1755,7 @@ static HRESULT alloc_array(script_ctx_t *ctx, jsdisp_t *object_prototype, ArrayI
...
@@ -1755,7 +1755,7 @@ static HRESULT alloc_array(script_ctx_t *ctx, jsdisp_t *object_prototype, ArrayI
ArrayInstance
*
array
;
ArrayInstance
*
array
;
HRESULT
hres
;
HRESULT
hres
;
array
=
heap_alloc_zero
(
sizeof
(
ArrayInstance
));
array
=
calloc
(
1
,
sizeof
(
ArrayInstance
));
if
(
!
array
)
if
(
!
array
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -1765,7 +1765,7 @@ static HRESULT alloc_array(script_ctx_t *ctx, jsdisp_t *object_prototype, ArrayI
...
@@ -1765,7 +1765,7 @@ static HRESULT alloc_array(script_ctx_t *ctx, jsdisp_t *object_prototype, ArrayI
hres
=
init_dispex_from_constr
(
&
array
->
dispex
,
ctx
,
&
ArrayInst_info
,
ctx
->
array_constr
);
hres
=
init_dispex_from_constr
(
&
array
->
dispex
,
ctx
,
&
ArrayInst_info
,
ctx
->
array_constr
);
if
(
FAILED
(
hres
))
{
if
(
FAILED
(
hres
))
{
heap_
free
(
array
);
free
(
array
);
return
hres
;
return
hres
;
}
}
...
...
dlls/jscript/bool.c
View file @
ae73e09a
...
@@ -180,7 +180,7 @@ static HRESULT alloc_bool(script_ctx_t *ctx, jsdisp_t *object_prototype, BoolIns
...
@@ -180,7 +180,7 @@ static HRESULT alloc_bool(script_ctx_t *ctx, jsdisp_t *object_prototype, BoolIns
BoolInstance
*
bool
;
BoolInstance
*
bool
;
HRESULT
hres
;
HRESULT
hres
;
bool
=
heap_alloc_zero
(
sizeof
(
BoolInstance
));
bool
=
calloc
(
1
,
sizeof
(
BoolInstance
));
if
(
!
bool
)
if
(
!
bool
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -190,7 +190,7 @@ static HRESULT alloc_bool(script_ctx_t *ctx, jsdisp_t *object_prototype, BoolIns
...
@@ -190,7 +190,7 @@ static HRESULT alloc_bool(script_ctx_t *ctx, jsdisp_t *object_prototype, BoolIns
hres
=
init_dispex_from_constr
(
&
bool
->
dispex
,
ctx
,
&
BoolInst_info
,
ctx
->
bool_constr
);
hres
=
init_dispex_from_constr
(
&
bool
->
dispex
,
ctx
,
&
BoolInst_info
,
ctx
->
bool_constr
);
if
(
FAILED
(
hres
))
{
if
(
FAILED
(
hres
))
{
heap_
free
(
bool
);
free
(
bool
);
return
hres
;
return
hres
;
}
}
...
...
dlls/jscript/compile.c
View file @
ae73e09a
...
@@ -153,7 +153,7 @@ static BOOL alloc_local_scope(compiler_ctx_t *ctx, unsigned int *scope_index)
...
@@ -153,7 +153,7 @@ static BOOL alloc_local_scope(compiler_ctx_t *ctx, unsigned int *scope_index)
if
(
scope
==
ctx
->
local_scope_size
)
if
(
scope
==
ctx
->
local_scope_size
)
{
{
new_size
=
max
(
1
,
ctx
->
local_scope_size
*
2
);
new_size
=
max
(
1
,
ctx
->
local_scope_size
*
2
);
if
(
!
(
new_alloc
=
heap_
realloc
(
ctx
->
local_scopes
,
new_size
*
sizeof
(
*
ctx
->
local_scopes
))))
if
(
!
(
new_alloc
=
realloc
(
ctx
->
local_scopes
,
new_size
*
sizeof
(
*
ctx
->
local_scopes
))))
return
FALSE
;
return
FALSE
;
ctx
->
local_scopes
=
new_alloc
;
ctx
->
local_scopes
=
new_alloc
;
ctx
->
local_scope_size
=
new_size
;
ctx
->
local_scope_size
=
new_size
;
...
@@ -191,14 +191,14 @@ jsstr_t *compiler_alloc_string_len(compiler_ctx_t *ctx, const WCHAR *str, unsign
...
@@ -191,14 +191,14 @@ jsstr_t *compiler_alloc_string_len(compiler_ctx_t *ctx, const WCHAR *str, unsign
jsstr_t
*
new_str
;
jsstr_t
*
new_str
;
if
(
!
ctx
->
code
->
str_pool_size
)
{
if
(
!
ctx
->
code
->
str_pool_size
)
{
ctx
->
code
->
str_pool
=
heap_
alloc
(
8
*
sizeof
(
jsstr_t
*
));
ctx
->
code
->
str_pool
=
m
alloc
(
8
*
sizeof
(
jsstr_t
*
));
if
(
!
ctx
->
code
->
str_pool
)
if
(
!
ctx
->
code
->
str_pool
)
return
NULL
;
return
NULL
;
ctx
->
code
->
str_pool_size
=
8
;
ctx
->
code
->
str_pool_size
=
8
;
}
else
if
(
ctx
->
code
->
str_pool_size
==
ctx
->
code
->
str_cnt
)
{
}
else
if
(
ctx
->
code
->
str_pool_size
==
ctx
->
code
->
str_cnt
)
{
jsstr_t
**
new_pool
;
jsstr_t
**
new_pool
;
new_pool
=
heap_
realloc
(
ctx
->
code
->
str_pool
,
ctx
->
code
->
str_pool_size
*
2
*
sizeof
(
jsstr_t
*
));
new_pool
=
realloc
(
ctx
->
code
->
str_pool
,
ctx
->
code
->
str_pool_size
*
2
*
sizeof
(
jsstr_t
*
));
if
(
!
new_pool
)
if
(
!
new_pool
)
return
NULL
;
return
NULL
;
...
@@ -222,14 +222,14 @@ static jsstr_t *compiler_alloc_string(compiler_ctx_t *ctx, const WCHAR *str)
...
@@ -222,14 +222,14 @@ static jsstr_t *compiler_alloc_string(compiler_ctx_t *ctx, const WCHAR *str)
static
BOOL
ensure_bstr_slot
(
compiler_ctx_t
*
ctx
)
static
BOOL
ensure_bstr_slot
(
compiler_ctx_t
*
ctx
)
{
{
if
(
!
ctx
->
code
->
bstr_pool_size
)
{
if
(
!
ctx
->
code
->
bstr_pool_size
)
{
ctx
->
code
->
bstr_pool
=
heap_
alloc
(
8
*
sizeof
(
BSTR
));
ctx
->
code
->
bstr_pool
=
m
alloc
(
8
*
sizeof
(
BSTR
));
if
(
!
ctx
->
code
->
bstr_pool
)
if
(
!
ctx
->
code
->
bstr_pool
)
return
FALSE
;
return
FALSE
;
ctx
->
code
->
bstr_pool_size
=
8
;
ctx
->
code
->
bstr_pool_size
=
8
;
}
else
if
(
ctx
->
code
->
bstr_pool_size
==
ctx
->
code
->
bstr_cnt
)
{
}
else
if
(
ctx
->
code
->
bstr_pool_size
==
ctx
->
code
->
bstr_cnt
)
{
BSTR
*
new_pool
;
BSTR
*
new_pool
;
new_pool
=
heap_
realloc
(
ctx
->
code
->
bstr_pool
,
ctx
->
code
->
bstr_pool_size
*
2
*
sizeof
(
BSTR
));
new_pool
=
realloc
(
ctx
->
code
->
bstr_pool
,
ctx
->
code
->
bstr_pool_size
*
2
*
sizeof
(
BSTR
));
if
(
!
new_pool
)
if
(
!
new_pool
)
return
FALSE
;
return
FALSE
;
...
@@ -276,7 +276,7 @@ static unsigned push_instr(compiler_ctx_t *ctx, jsop_t op)
...
@@ -276,7 +276,7 @@ static unsigned push_instr(compiler_ctx_t *ctx, jsop_t op)
if
(
ctx
->
code_size
==
ctx
->
code_off
)
{
if
(
ctx
->
code_size
==
ctx
->
code_off
)
{
instr_t
*
new_instrs
;
instr_t
*
new_instrs
;
new_instrs
=
heap_
realloc
(
ctx
->
code
->
instrs
,
ctx
->
code_size
*
2
*
sizeof
(
instr_t
));
new_instrs
=
realloc
(
ctx
->
code
->
instrs
,
ctx
->
code_size
*
2
*
sizeof
(
instr_t
));
if
(
!
new_instrs
)
if
(
!
new_instrs
)
return
0
;
return
0
;
...
@@ -457,14 +457,14 @@ static HRESULT compile_member_expression(compiler_ctx_t *ctx, member_expression_
...
@@ -457,14 +457,14 @@ static HRESULT compile_member_expression(compiler_ctx_t *ctx, member_expression_
static
unsigned
alloc_label
(
compiler_ctx_t
*
ctx
)
static
unsigned
alloc_label
(
compiler_ctx_t
*
ctx
)
{
{
if
(
!
ctx
->
labels_size
)
{
if
(
!
ctx
->
labels_size
)
{
ctx
->
labels
=
heap_
alloc
(
8
*
sizeof
(
*
ctx
->
labels
));
ctx
->
labels
=
m
alloc
(
8
*
sizeof
(
*
ctx
->
labels
));
if
(
!
ctx
->
labels
)
if
(
!
ctx
->
labels
)
return
0
;
return
0
;
ctx
->
labels_size
=
8
;
ctx
->
labels_size
=
8
;
}
else
if
(
ctx
->
labels_size
==
ctx
->
labels_cnt
)
{
}
else
if
(
ctx
->
labels_size
==
ctx
->
labels_cnt
)
{
unsigned
*
new_labels
;
unsigned
*
new_labels
;
new_labels
=
heap_
realloc
(
ctx
->
labels
,
2
*
ctx
->
labels_size
*
sizeof
(
*
ctx
->
labels
));
new_labels
=
realloc
(
ctx
->
labels
,
2
*
ctx
->
labels_size
*
sizeof
(
*
ctx
->
labels
));
if
(
!
new_labels
)
if
(
!
new_labels
)
return
0
;
return
0
;
...
@@ -1741,7 +1741,7 @@ static HRESULT compile_switch_statement(compiler_ctx_t *ctx, switch_statement_t
...
@@ -1741,7 +1741,7 @@ static HRESULT compile_switch_statement(compiler_ctx_t *ctx, switch_statement_t
case_cnt
++
;
case_cnt
++
;
}
}
case_jmps
=
heap_
alloc
(
case_cnt
*
sizeof
(
*
case_jmps
));
case_jmps
=
m
alloc
(
case_cnt
*
sizeof
(
*
case_jmps
));
if
(
!
case_jmps
)
if
(
!
case_jmps
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -1775,7 +1775,7 @@ static HRESULT compile_switch_statement(compiler_ctx_t *ctx, switch_statement_t
...
@@ -1775,7 +1775,7 @@ static HRESULT compile_switch_statement(compiler_ctx_t *ctx, switch_statement_t
}
}
if
(
FAILED
(
hres
))
{
if
(
FAILED
(
hres
))
{
heap_
free
(
case_jmps
);
free
(
case_jmps
);
return
hres
;
return
hres
;
}
}
...
@@ -1798,7 +1798,7 @@ static HRESULT compile_switch_statement(compiler_ctx_t *ctx, switch_statement_t
...
@@ -1798,7 +1798,7 @@ static HRESULT compile_switch_statement(compiler_ctx_t *ctx, switch_statement_t
break
;
break
;
}
}
heap_
free
(
case_jmps
);
free
(
case_jmps
);
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
assert
(
i
==
case_cnt
);
assert
(
i
==
case_cnt
);
...
@@ -2466,12 +2466,12 @@ void release_bytecode(bytecode_t *code)
...
@@ -2466,12 +2466,12 @@ void release_bytecode(bytecode_t *code)
if
(
code
->
named_item
)
if
(
code
->
named_item
)
release_named_item
(
code
->
named_item
);
release_named_item
(
code
->
named_item
);
heap_
free
(
code
->
source
);
free
(
code
->
source
);
heap_pool_free
(
&
code
->
heap
);
heap_pool_free
(
&
code
->
heap
);
heap_
free
(
code
->
bstr_pool
);
free
(
code
->
bstr_pool
);
heap_
free
(
code
->
str_pool
);
free
(
code
->
str_pool
);
heap_
free
(
code
->
instrs
);
free
(
code
->
instrs
);
heap_
free
(
code
);
free
(
code
);
}
}
static
HRESULT
init_code
(
compiler_ctx_t
*
compiler
,
const
WCHAR
*
source
,
UINT64
source_context
,
unsigned
start_line
)
static
HRESULT
init_code
(
compiler_ctx_t
*
compiler
,
const
WCHAR
*
source
,
UINT64
source_context
,
unsigned
start_line
)
...
@@ -2481,7 +2481,7 @@ static HRESULT init_code(compiler_ctx_t *compiler, const WCHAR *source, UINT64 s
...
@@ -2481,7 +2481,7 @@ static HRESULT init_code(compiler_ctx_t *compiler, const WCHAR *source, UINT64 s
if
(
len
>
INT32_MAX
)
if
(
len
>
INT32_MAX
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
compiler
->
code
=
heap_alloc_zero
(
sizeof
(
bytecode_t
));
compiler
->
code
=
calloc
(
1
,
sizeof
(
bytecode_t
));
if
(
!
compiler
->
code
)
if
(
!
compiler
->
code
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -2490,7 +2490,7 @@ static HRESULT init_code(compiler_ctx_t *compiler, const WCHAR *source, UINT64 s
...
@@ -2490,7 +2490,7 @@ static HRESULT init_code(compiler_ctx_t *compiler, const WCHAR *source, UINT64 s
compiler
->
code
->
start_line
=
start_line
;
compiler
->
code
->
start_line
=
start_line
;
heap_pool_init
(
&
compiler
->
code
->
heap
);
heap_pool_init
(
&
compiler
->
code
->
heap
);
compiler
->
code
->
source
=
heap_
alloc
((
len
+
1
)
*
sizeof
(
WCHAR
));
compiler
->
code
->
source
=
m
alloc
((
len
+
1
)
*
sizeof
(
WCHAR
));
if
(
!
compiler
->
code
->
source
)
{
if
(
!
compiler
->
code
->
source
)
{
release_bytecode
(
compiler
->
code
);
release_bytecode
(
compiler
->
code
);
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -2499,7 +2499,7 @@ static HRESULT init_code(compiler_ctx_t *compiler, const WCHAR *source, UINT64 s
...
@@ -2499,7 +2499,7 @@ static HRESULT init_code(compiler_ctx_t *compiler, const WCHAR *source, UINT64 s
memcpy
(
compiler
->
code
->
source
,
source
,
len
*
sizeof
(
WCHAR
));
memcpy
(
compiler
->
code
->
source
,
source
,
len
*
sizeof
(
WCHAR
));
compiler
->
code
->
source
[
len
]
=
0
;
compiler
->
code
->
source
[
len
]
=
0
;
compiler
->
code
->
instrs
=
heap_
alloc
(
64
*
sizeof
(
instr_t
));
compiler
->
code
->
instrs
=
m
alloc
(
64
*
sizeof
(
instr_t
));
if
(
!
compiler
->
code
->
instrs
)
{
if
(
!
compiler
->
code
->
instrs
)
{
release_bytecode
(
compiler
->
code
);
release_bytecode
(
compiler
->
code
);
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -2751,7 +2751,7 @@ HRESULT compile_script(script_ctx_t *ctx, const WCHAR *code, UINT64 source_conte
...
@@ -2751,7 +2751,7 @@ HRESULT compile_script(script_ctx_t *ctx, const WCHAR *code, UINT64 source_conte
heap_pool_init
(
&
compiler
.
heap
);
heap_pool_init
(
&
compiler
.
heap
);
hres
=
compile_function
(
&
compiler
,
compiler
.
parser
->
source
,
NULL
,
from_eval
,
&
compiler
.
code
->
global_code
);
hres
=
compile_function
(
&
compiler
,
compiler
.
parser
->
source
,
NULL
,
from_eval
,
&
compiler
.
code
->
global_code
);
heap_
free
(
compiler
.
local_scopes
);
free
(
compiler
.
local_scopes
);
heap_pool_free
(
&
compiler
.
heap
);
heap_pool_free
(
&
compiler
.
heap
);
parser_release
(
compiler
.
parser
);
parser_release
(
compiler
.
parser
);
if
(
FAILED
(
hres
))
{
if
(
FAILED
(
hres
))
{
...
...
dlls/jscript/date.c
View file @
ae73e09a
...
@@ -1924,7 +1924,7 @@ static HRESULT create_date(script_ctx_t *ctx, jsdisp_t *object_prototype, DOUBLE
...
@@ -1924,7 +1924,7 @@ static HRESULT create_date(script_ctx_t *ctx, jsdisp_t *object_prototype, DOUBLE
GetTimeZoneInformation
(
&
tzi
);
GetTimeZoneInformation
(
&
tzi
);
date
=
heap_alloc_zero
(
sizeof
(
DateInstance
));
date
=
calloc
(
1
,
sizeof
(
DateInstance
));
if
(
!
date
)
if
(
!
date
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -1933,7 +1933,7 @@ static HRESULT create_date(script_ctx_t *ctx, jsdisp_t *object_prototype, DOUBLE
...
@@ -1933,7 +1933,7 @@ static HRESULT create_date(script_ctx_t *ctx, jsdisp_t *object_prototype, DOUBLE
else
else
hres
=
init_dispex_from_constr
(
&
date
->
dispex
,
ctx
,
&
DateInst_info
,
ctx
->
date_constr
);
hres
=
init_dispex_from_constr
(
&
date
->
dispex
,
ctx
,
&
DateInst_info
,
ctx
->
date_constr
);
if
(
FAILED
(
hres
))
{
if
(
FAILED
(
hres
))
{
heap_
free
(
date
);
free
(
date
);
return
hres
;
return
hres
;
}
}
...
@@ -1986,7 +1986,7 @@ static inline HRESULT date_parse(jsstr_t *input_str, double *ret) {
...
@@ -1986,7 +1986,7 @@ static inline HRESULT date_parse(jsstr_t *input_str, double *ret) {
else
if
(
!
nest_level
)
parse_len
++
;
else
if
(
!
nest_level
)
parse_len
++
;
}
}
parse
=
heap_
alloc
((
parse_len
+
1
)
*
sizeof
(
WCHAR
));
parse
=
m
alloc
((
parse_len
+
1
)
*
sizeof
(
WCHAR
));
if
(
!
parse
)
if
(
!
parse
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
nest_level
=
0
;
nest_level
=
0
;
...
@@ -2009,12 +2009,12 @@ static inline HRESULT date_parse(jsstr_t *input_str, double *ret) {
...
@@ -2009,12 +2009,12 @@ static inline HRESULT date_parse(jsstr_t *input_str, double *ret) {
lcid_en
=
MAKELCID
(
MAKELANGID
(
LANG_ENGLISH
,
SUBLANG_ENGLISH_US
),
SORT_DEFAULT
);
lcid_en
=
MAKELCID
(
MAKELANGID
(
LANG_ENGLISH
,
SUBLANG_ENGLISH_US
),
SORT_DEFAULT
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
string_ids
);
i
++
)
{
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
string_ids
);
i
++
)
{
size
=
GetLocaleInfoW
(
lcid_en
,
string_ids
[
i
],
NULL
,
0
);
size
=
GetLocaleInfoW
(
lcid_en
,
string_ids
[
i
],
NULL
,
0
);
strings
[
i
]
=
heap_
alloc
((
size
+
1
)
*
sizeof
(
WCHAR
));
strings
[
i
]
=
m
alloc
((
size
+
1
)
*
sizeof
(
WCHAR
));
if
(
!
strings
[
i
])
{
if
(
!
strings
[
i
])
{
i
--
;
i
--
;
while
(
i
--
>=
0
)
while
(
i
--
>=
0
)
heap_
free
(
strings
[
i
]);
free
(
strings
[
i
]);
heap_
free
(
parse
);
free
(
parse
);
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
GetLocaleInfoW
(
lcid_en
,
string_ids
[
i
],
strings
[
i
],
size
);
GetLocaleInfoW
(
lcid_en
,
string_ids
[
i
],
strings
[
i
],
size
);
...
@@ -2222,8 +2222,8 @@ static inline HRESULT date_parse(jsstr_t *input_str, double *ret) {
...
@@ -2222,8 +2222,8 @@ static inline HRESULT date_parse(jsstr_t *input_str, double *ret) {
}
}
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
string_ids
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
string_ids
);
i
++
)
heap_
free
(
strings
[
i
]);
free
(
strings
[
i
]);
heap_
free
(
parse
);
free
(
parse
);
return
S_OK
;
return
S_OK
;
}
}
...
...
dlls/jscript/engine.c
View file @
ae73e09a
...
@@ -426,7 +426,7 @@ static HRESULT scope_push(scope_chain_t *scope, jsdisp_t *jsobj, IDispatch *obj,
...
@@ -426,7 +426,7 @@ static HRESULT scope_push(scope_chain_t *scope, jsdisp_t *jsobj, IDispatch *obj,
{
{
scope_chain_t
*
new_scope
;
scope_chain_t
*
new_scope
;
new_scope
=
heap_
alloc
(
sizeof
(
scope_chain_t
));
new_scope
=
m
alloc
(
sizeof
(
scope_chain_t
));
if
(
!
new_scope
)
if
(
!
new_scope
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -463,7 +463,7 @@ void scope_release(scope_chain_t *scope)
...
@@ -463,7 +463,7 @@ void scope_release(scope_chain_t *scope)
if
(
scope
->
obj
)
if
(
scope
->
obj
)
IDispatch_Release
(
scope
->
obj
);
IDispatch_Release
(
scope
->
obj
);
heap_
free
(
scope
);
free
(
scope
);
}
}
static
HRESULT
disp_get_id
(
script_ctx_t
*
ctx
,
IDispatch
*
disp
,
const
WCHAR
*
name
,
BSTR
name_bstr
,
DWORD
flags
,
DISPID
*
id
)
static
HRESULT
disp_get_id
(
script_ctx_t
*
ctx
,
IDispatch
*
disp
,
const
WCHAR
*
name
,
BSTR
name_bstr
,
DWORD
flags
,
DISPID
*
id
)
...
@@ -1115,7 +1115,7 @@ static HRESULT interp_push_except(script_ctx_t *ctx)
...
@@ -1115,7 +1115,7 @@ static HRESULT interp_push_except(script_ctx_t *ctx)
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
except
=
heap_
alloc
(
sizeof
(
*
except
));
except
=
m
alloc
(
sizeof
(
*
except
));
if
(
!
except
)
if
(
!
except
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -1143,7 +1143,7 @@ static HRESULT interp_pop_except(script_ctx_t *ctx)
...
@@ -1143,7 +1143,7 @@ static HRESULT interp_pop_except(script_ctx_t *ctx)
finally_off
=
except
->
finally_off
;
finally_off
=
except
->
finally_off
;
frame
->
except_frame
=
except
->
next
;
frame
->
except_frame
=
except
->
next
;
heap_
free
(
except
);
free
(
except
);
if
(
finally_off
)
{
if
(
finally_off
)
{
HRESULT
hres
;
HRESULT
hres
;
...
@@ -2944,7 +2944,7 @@ static void pop_call_frame(script_ctx_t *ctx)
...
@@ -2944,7 +2944,7 @@ static void pop_call_frame(script_ctx_t *ctx)
IDispatch_Release
(
frame
->
this_obj
);
IDispatch_Release
(
frame
->
this_obj
);
jsval_release
(
frame
->
ret
);
jsval_release
(
frame
->
ret
);
release_bytecode
(
frame
->
bytecode
);
release_bytecode
(
frame
->
bytecode
);
heap_
free
(
frame
);
free
(
frame
);
}
}
static
void
print_backtrace
(
script_ctx_t
*
ctx
)
static
void
print_backtrace
(
script_ctx_t
*
ctx
)
...
@@ -3056,7 +3056,7 @@ static HRESULT unwind_exception(script_ctx_t *ctx, HRESULT exception_hres)
...
@@ -3056,7 +3056,7 @@ static HRESULT unwind_exception(script_ctx_t *ctx, HRESULT exception_hres)
except_frame
->
catch_off
=
0
;
except_frame
->
catch_off
=
0
;
}
else
{
}
else
{
frame
->
except_frame
=
except_frame
->
next
;
frame
->
except_frame
=
except_frame
->
next
;
heap_
free
(
except_frame
);
free
(
except_frame
);
}
}
hres
=
stack_push
(
ctx
,
except_val
);
hres
=
stack_push
(
ctx
,
except_val
);
...
@@ -3231,7 +3231,7 @@ HRESULT exec_source(script_ctx_t *ctx, DWORD flags, bytecode_t *bytecode, functi
...
@@ -3231,7 +3231,7 @@ HRESULT exec_source(script_ctx_t *ctx, DWORD flags, bytecode_t *bytecode, functi
HRESULT
hres
;
HRESULT
hres
;
if
(
!
ctx
->
stack
)
{
if
(
!
ctx
->
stack
)
{
ctx
->
stack
=
heap_
alloc
(
stack_size
*
sizeof
(
*
ctx
->
stack
));
ctx
->
stack
=
m
alloc
(
stack_size
*
sizeof
(
*
ctx
->
stack
));
if
(
!
ctx
->
stack
)
if
(
!
ctx
->
stack
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
...
@@ -3331,7 +3331,7 @@ HRESULT exec_source(script_ctx_t *ctx, DWORD flags, bytecode_t *bytecode, functi
...
@@ -3331,7 +3331,7 @@ HRESULT exec_source(script_ctx_t *ctx, DWORD flags, bytecode_t *bytecode, functi
goto
fail
;
goto
fail
;
}
}
frame
=
heap_alloc_zero
(
sizeof
(
*
frame
));
frame
=
calloc
(
1
,
sizeof
(
*
frame
));
if
(
!
frame
)
{
if
(
!
frame
)
{
hres
=
E_OUTOFMEMORY
;
hres
=
E_OUTOFMEMORY
;
goto
fail
;
goto
fail
;
...
@@ -3346,7 +3346,7 @@ HRESULT exec_source(script_ctx_t *ctx, DWORD flags, bytecode_t *bytecode, functi
...
@@ -3346,7 +3346,7 @@ HRESULT exec_source(script_ctx_t *ctx, DWORD flags, bytecode_t *bytecode, functi
hres
=
setup_scope
(
ctx
,
frame
,
scope
,
variable_obj
,
argc
,
argv
);
hres
=
setup_scope
(
ctx
,
frame
,
scope
,
variable_obj
,
argc
,
argv
);
if
(
FAILED
(
hres
))
{
if
(
FAILED
(
hres
))
{
release_bytecode
(
frame
->
bytecode
);
release_bytecode
(
frame
->
bytecode
);
heap_
free
(
frame
);
free
(
frame
);
goto
fail
;
goto
fail
;
}
}
}
else
if
(
scope
)
{
}
else
if
(
scope
)
{
...
...
dlls/jscript/enumerator.c
View file @
ae73e09a
...
@@ -85,7 +85,7 @@ static void Enumerator_destructor(jsdisp_t *dispex)
...
@@ -85,7 +85,7 @@ static void Enumerator_destructor(jsdisp_t *dispex)
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
jsval_release
(
This
->
item
);
jsval_release
(
This
->
item
);
heap_
free
(
dispex
);
free
(
dispex
);
}
}
static
HRESULT
Enumerator_atEnd
(
script_ctx_t
*
ctx
,
jsval_t
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
static
HRESULT
Enumerator_atEnd
(
script_ctx_t
*
ctx
,
jsval_t
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
...
@@ -197,7 +197,7 @@ static HRESULT alloc_enumerator(script_ctx_t *ctx, jsdisp_t *object_prototype, E
...
@@ -197,7 +197,7 @@ static HRESULT alloc_enumerator(script_ctx_t *ctx, jsdisp_t *object_prototype, E
EnumeratorInstance
*
enumerator
;
EnumeratorInstance
*
enumerator
;
HRESULT
hres
;
HRESULT
hres
;
enumerator
=
heap_alloc_zero
(
sizeof
(
EnumeratorInstance
));
enumerator
=
calloc
(
1
,
sizeof
(
EnumeratorInstance
));
if
(
!
enumerator
)
if
(
!
enumerator
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -209,7 +209,7 @@ static HRESULT alloc_enumerator(script_ctx_t *ctx, jsdisp_t *object_prototype, E
...
@@ -209,7 +209,7 @@ static HRESULT alloc_enumerator(script_ctx_t *ctx, jsdisp_t *object_prototype, E
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
{
{
heap_
free
(
enumerator
);
free
(
enumerator
);
return
hres
;
return
hres
;
}
}
...
...
dlls/jscript/error.c
View file @
ae73e09a
...
@@ -162,7 +162,7 @@ static HRESULT alloc_error(script_ctx_t *ctx, jsdisp_t *prototype,
...
@@ -162,7 +162,7 @@ static HRESULT alloc_error(script_ctx_t *ctx, jsdisp_t *prototype,
jsdisp_t
*
err
;
jsdisp_t
*
err
;
HRESULT
hres
;
HRESULT
hres
;
err
=
heap_alloc_zero
(
sizeof
(
*
err
));
err
=
calloc
(
1
,
sizeof
(
*
err
));
if
(
!
err
)
if
(
!
err
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -172,7 +172,7 @@ static HRESULT alloc_error(script_ctx_t *ctx, jsdisp_t *prototype,
...
@@ -172,7 +172,7 @@ static HRESULT alloc_error(script_ctx_t *ctx, jsdisp_t *prototype,
hres
=
init_dispex_from_constr
(
err
,
ctx
,
&
ErrorInst_info
,
hres
=
init_dispex_from_constr
(
err
,
ctx
,
&
ErrorInst_info
,
constr
?
constr
:
ctx
->
error_constr
);
constr
?
constr
:
ctx
->
error_constr
);
if
(
FAILED
(
hres
))
{
if
(
FAILED
(
hres
))
{
heap_
free
(
err
);
free
(
err
);
return
hres
;
return
hres
;
}
}
...
...
dlls/jscript/function.c
View file @
ae73e09a
...
@@ -105,11 +105,11 @@ static void Arguments_destructor(jsdisp_t *jsdisp)
...
@@ -105,11 +105,11 @@ static void Arguments_destructor(jsdisp_t *jsdisp)
unsigned
i
;
unsigned
i
;
for
(
i
=
0
;
i
<
arguments
->
argc
;
i
++
)
for
(
i
=
0
;
i
<
arguments
->
argc
;
i
++
)
jsval_release
(
arguments
->
buf
[
i
]);
jsval_release
(
arguments
->
buf
[
i
]);
heap_
free
(
arguments
->
buf
);
free
(
arguments
->
buf
);
}
}
jsdisp_release
(
&
arguments
->
function
->
function
.
dispex
);
jsdisp_release
(
&
arguments
->
function
->
function
.
dispex
);
heap_
free
(
arguments
);
free
(
arguments
);
}
}
static
unsigned
Arguments_idx_length
(
jsdisp_t
*
jsdisp
)
static
unsigned
Arguments_idx_length
(
jsdisp_t
*
jsdisp
)
...
@@ -182,13 +182,13 @@ HRESULT setup_arguments_object(script_ctx_t *ctx, call_frame_t *frame)
...
@@ -182,13 +182,13 @@ HRESULT setup_arguments_object(script_ctx_t *ctx, call_frame_t *frame)
ArgumentsInstance
*
args
;
ArgumentsInstance
*
args
;
HRESULT
hres
;
HRESULT
hres
;
args
=
heap_alloc_zero
(
sizeof
(
*
args
));
args
=
calloc
(
1
,
sizeof
(
*
args
));
if
(
!
args
)
if
(
!
args
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
hres
=
init_dispex_from_constr
(
&
args
->
jsdisp
,
ctx
,
&
Arguments_info
,
ctx
->
object_constr
);
hres
=
init_dispex_from_constr
(
&
args
->
jsdisp
,
ctx
,
&
Arguments_info
,
ctx
->
object_constr
);
if
(
FAILED
(
hres
))
{
if
(
FAILED
(
hres
))
{
heap_
free
(
args
);
free
(
args
);
return
hres
;
return
hres
;
}
}
...
@@ -226,7 +226,7 @@ void detach_arguments_object(jsdisp_t *args_disp)
...
@@ -226,7 +226,7 @@ void detach_arguments_object(jsdisp_t *args_disp)
/* Don't bother coppying arguments if call frame holds the last reference. */
/* Don't bother coppying arguments if call frame holds the last reference. */
if
(
arguments
->
jsdisp
.
ref
>
1
)
{
if
(
arguments
->
jsdisp
.
ref
>
1
)
{
arguments
->
buf
=
heap_
alloc
(
arguments
->
argc
*
sizeof
(
*
arguments
->
buf
));
arguments
->
buf
=
m
alloc
(
arguments
->
argc
*
sizeof
(
*
arguments
->
buf
));
if
(
arguments
->
buf
)
{
if
(
arguments
->
buf
)
{
int
i
;
int
i
;
...
@@ -315,7 +315,7 @@ static HRESULT array_to_args(script_ctx_t *ctx, jsdisp_t *arg_array, unsigned *a
...
@@ -315,7 +315,7 @@ static HRESULT array_to_args(script_ctx_t *ctx, jsdisp_t *arg_array, unsigned *a
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
argv
=
heap_
alloc
(
length
*
sizeof
(
*
argv
));
argv
=
m
alloc
(
length
*
sizeof
(
*
argv
));
if
(
!
argv
)
if
(
!
argv
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -326,7 +326,7 @@ static HRESULT array_to_args(script_ctx_t *ctx, jsdisp_t *arg_array, unsigned *a
...
@@ -326,7 +326,7 @@ static HRESULT array_to_args(script_ctx_t *ctx, jsdisp_t *arg_array, unsigned *a
}
else
if
(
FAILED
(
hres
))
{
}
else
if
(
FAILED
(
hres
))
{
while
(
i
--
)
while
(
i
--
)
jsval_release
(
argv
[
i
]);
jsval_release
(
argv
[
i
]);
heap_
free
(
argv
);
free
(
argv
);
return
hres
;
return
hres
;
}
}
}
}
...
@@ -405,7 +405,7 @@ static HRESULT Function_apply(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsi
...
@@ -405,7 +405,7 @@ static HRESULT Function_apply(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsi
jsval_release
(
this_val
);
jsval_release
(
this_val
);
for
(
i
=
0
;
i
<
cnt
;
i
++
)
for
(
i
=
0
;
i
<
cnt
;
i
++
)
jsval_release
(
args
[
i
]);
jsval_release
(
args
[
i
]);
heap_
free
(
args
);
free
(
args
);
return
hres
;
return
hres
;
}
}
...
@@ -551,7 +551,7 @@ static void Function_destructor(jsdisp_t *dispex)
...
@@ -551,7 +551,7 @@ static void Function_destructor(jsdisp_t *dispex)
{
{
FunctionInstance
*
function
=
function_from_jsdisp
(
dispex
);
FunctionInstance
*
function
=
function_from_jsdisp
(
dispex
);
function
->
vtbl
->
destructor
(
function
);
function
->
vtbl
->
destructor
(
function
);
heap_
free
(
function
);
free
(
function
);
}
}
static
const
builtin_prop_t
Function_props
[]
=
{
static
const
builtin_prop_t
Function_props
[]
=
{
...
@@ -592,7 +592,7 @@ static HRESULT create_function(script_ctx_t *ctx, const builtin_info_t *builtin_
...
@@ -592,7 +592,7 @@ static HRESULT create_function(script_ctx_t *ctx, const builtin_info_t *builtin_
FunctionInstance
*
function
;
FunctionInstance
*
function
;
HRESULT
hres
;
HRESULT
hres
;
function
=
heap_alloc_zero
(
size
);
function
=
calloc
(
1
,
size
);
if
(
!
function
)
if
(
!
function
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -603,7 +603,7 @@ static HRESULT create_function(script_ctx_t *ctx, const builtin_info_t *builtin_
...
@@ -603,7 +603,7 @@ static HRESULT create_function(script_ctx_t *ctx, const builtin_info_t *builtin_
else
else
hres
=
init_dispex_from_constr
(
&
function
->
dispex
,
ctx
,
&
FunctionInst_info
,
ctx
->
function_constr
);
hres
=
init_dispex_from_constr
(
&
function
->
dispex
,
ctx
,
&
FunctionInst_info
,
ctx
->
function_constr
);
if
(
FAILED
(
hres
))
{
if
(
FAILED
(
hres
))
{
heap_
free
(
function
);
free
(
function
);
return
hres
;
return
hres
;
}
}
...
@@ -840,7 +840,7 @@ static HRESULT BindFunction_call(script_ctx_t *ctx, FunctionInstance *func, jsva
...
@@ -840,7 +840,7 @@ static HRESULT BindFunction_call(script_ctx_t *ctx, FunctionInstance *func, jsva
call_argc
=
function
->
argc
+
argc
;
call_argc
=
function
->
argc
+
argc
;
if
(
call_argc
)
{
if
(
call_argc
)
{
call_args
=
heap_
alloc
(
call_argc
*
sizeof
(
*
call_args
));
call_args
=
m
alloc
(
call_argc
*
sizeof
(
*
call_args
));
if
(
!
call_args
)
if
(
!
call_args
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -852,7 +852,7 @@ static HRESULT BindFunction_call(script_ctx_t *ctx, FunctionInstance *func, jsva
...
@@ -852,7 +852,7 @@ static HRESULT BindFunction_call(script_ctx_t *ctx, FunctionInstance *func, jsva
hres
=
function
->
target
->
vtbl
->
call
(
ctx
,
function
->
target
,
function
->
this
,
flags
,
call_argc
,
call_args
,
r
);
hres
=
function
->
target
->
vtbl
->
call
(
ctx
,
function
->
target
,
function
->
this
,
flags
,
call_argc
,
call_args
,
r
);
heap_
free
(
call_args
);
free
(
call_args
);
return
hres
;
return
hres
;
}
}
...
@@ -936,7 +936,7 @@ static HRESULT construct_function(script_ctx_t *ctx, unsigned argc, jsval_t *arg
...
@@ -936,7 +936,7 @@ static HRESULT construct_function(script_ctx_t *ctx, unsigned argc, jsval_t *arg
static
const
WCHAR
function_endW
[]
=
L"
\n
}"
;
static
const
WCHAR
function_endW
[]
=
L"
\n
}"
;
if
(
argc
)
{
if
(
argc
)
{
params
=
heap_
alloc
(
argc
*
sizeof
(
*
params
));
params
=
m
alloc
(
argc
*
sizeof
(
*
params
));
if
(
!
params
)
if
(
!
params
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -952,7 +952,7 @@ static HRESULT construct_function(script_ctx_t *ctx, unsigned argc, jsval_t *arg
...
@@ -952,7 +952,7 @@ static HRESULT construct_function(script_ctx_t *ctx, unsigned argc, jsval_t *arg
if
(
SUCCEEDED
(
hres
))
{
if
(
SUCCEEDED
(
hres
))
{
len
+=
ARRAY_SIZE
(
function_anonymousW
)
+
ARRAY_SIZE
(
function_beginW
)
+
ARRAY_SIZE
(
function_endW
)
-
2
;
len
+=
ARRAY_SIZE
(
function_anonymousW
)
+
ARRAY_SIZE
(
function_beginW
)
+
ARRAY_SIZE
(
function_endW
)
-
2
;
str
=
heap_
alloc
(
len
*
sizeof
(
WCHAR
));
str
=
m
alloc
(
len
*
sizeof
(
WCHAR
));
if
(
str
)
{
if
(
str
)
{
memcpy
(
str
,
function_anonymousW
,
sizeof
(
function_anonymousW
));
memcpy
(
str
,
function_anonymousW
,
sizeof
(
function_anonymousW
));
ptr
=
str
+
ARRAY_SIZE
(
function_anonymousW
)
-
1
;
ptr
=
str
+
ARRAY_SIZE
(
function_anonymousW
)
-
1
;
...
@@ -979,13 +979,13 @@ static HRESULT construct_function(script_ctx_t *ctx, unsigned argc, jsval_t *arg
...
@@ -979,13 +979,13 @@ static HRESULT construct_function(script_ctx_t *ctx, unsigned argc, jsval_t *arg
while
(
i
)
while
(
i
)
jsstr_release
(
params
[
--
i
]);
jsstr_release
(
params
[
--
i
]);
heap_
free
(
params
);
free
(
params
);
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
hres
=
compile_script
(
ctx
,
str
,
0
,
0
,
NULL
,
NULL
,
FALSE
,
FALSE
,
hres
=
compile_script
(
ctx
,
str
,
0
,
0
,
NULL
,
NULL
,
FALSE
,
FALSE
,
ctx
->
call_ctx
?
ctx
->
call_ctx
->
bytecode
->
named_item
:
NULL
,
&
code
);
ctx
->
call_ctx
?
ctx
->
call_ctx
->
bytecode
->
named_item
:
NULL
,
&
code
);
heap_
free
(
str
);
free
(
str
);
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
...
...
dlls/jscript/jscript.c
View file @
ae73e09a
...
@@ -83,7 +83,7 @@ void script_release(script_ctx_t *ctx)
...
@@ -83,7 +83,7 @@ void script_release(script_ctx_t *ctx)
if
(
ctx
->
last_match
)
if
(
ctx
->
last_match
)
jsstr_release
(
ctx
->
last_match
);
jsstr_release
(
ctx
->
last_match
);
assert
(
!
ctx
->
stack_top
);
assert
(
!
ctx
->
stack_top
);
heap_
free
(
ctx
->
stack
);
free
(
ctx
->
stack
);
ctx
->
jscaller
->
ctx
=
NULL
;
ctx
->
jscaller
->
ctx
=
NULL
;
IServiceProvider_Release
(
&
ctx
->
jscaller
->
IServiceProvider_iface
);
IServiceProvider_Release
(
&
ctx
->
jscaller
->
IServiceProvider_iface
);
...
...
dlls/jscript/jscript.h
View file @
ae73e09a
...
@@ -31,7 +31,6 @@
...
@@ -31,7 +31,6 @@
#include "resource.h"
#include "resource.h"
#include "wine/heap.h"
#include "wine/list.h"
#include "wine/list.h"
/*
/*
...
...
dlls/jscript/json.c
View file @
ae73e09a
...
@@ -74,7 +74,7 @@ static HRESULT parse_json_string(json_parse_ctx_t *ctx, WCHAR **r)
...
@@ -74,7 +74,7 @@ static HRESULT parse_json_string(json_parse_ctx_t *ctx, WCHAR **r)
}
}
len
=
ctx
->
ptr
-
ptr
;
len
=
ctx
->
ptr
-
ptr
;
buf
=
heap_
alloc
((
len
+
1
)
*
sizeof
(
WCHAR
));
buf
=
m
alloc
((
len
+
1
)
*
sizeof
(
WCHAR
));
if
(
!
buf
)
if
(
!
buf
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
if
(
len
)
if
(
len
)
...
@@ -82,7 +82,7 @@ static HRESULT parse_json_string(json_parse_ctx_t *ctx, WCHAR **r)
...
@@ -82,7 +82,7 @@ static HRESULT parse_json_string(json_parse_ctx_t *ctx, WCHAR **r)
if
(
!
unescape
(
buf
,
&
len
))
{
if
(
!
unescape
(
buf
,
&
len
))
{
FIXME
(
"unescape failed
\n
"
);
FIXME
(
"unescape failed
\n
"
);
heap_
free
(
buf
);
free
(
buf
);
return
E_FAIL
;
return
E_FAIL
;
}
}
...
@@ -144,7 +144,7 @@ static HRESULT parse_json_value(json_parse_ctx_t *ctx, jsval_t *r)
...
@@ -144,7 +144,7 @@ static HRESULT parse_json_value(json_parse_ctx_t *ctx, jsval_t *r)
if
(
skip_spaces
(
ctx
)
!=
':'
)
{
if
(
skip_spaces
(
ctx
)
!=
':'
)
{
FIXME
(
"missing ':'
\n
"
);
FIXME
(
"missing ':'
\n
"
);
heap_
free
(
prop_name
);
free
(
prop_name
);
break
;
break
;
}
}
...
@@ -154,7 +154,7 @@ static HRESULT parse_json_value(json_parse_ctx_t *ctx, jsval_t *r)
...
@@ -154,7 +154,7 @@ static HRESULT parse_json_value(json_parse_ctx_t *ctx, jsval_t *r)
hres
=
jsdisp_propput_name
(
obj
,
prop_name
,
val
);
hres
=
jsdisp_propput_name
(
obj
,
prop_name
,
val
);
jsval_release
(
val
);
jsval_release
(
val
);
}
}
heap_
free
(
prop_name
);
free
(
prop_name
);
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
break
;
break
;
...
@@ -186,7 +186,7 @@ static HRESULT parse_json_value(json_parse_ctx_t *ctx, jsval_t *r)
...
@@ -186,7 +186,7 @@ static HRESULT parse_json_value(json_parse_ctx_t *ctx, jsval_t *r)
/* FIXME: avoid reallocation */
/* FIXME: avoid reallocation */
str
=
jsstr_alloc
(
string
);
str
=
jsstr_alloc
(
string
);
heap_
free
(
string
);
free
(
string
);
if
(
!
str
)
if
(
!
str
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -435,14 +435,14 @@ typedef struct {
...
@@ -435,14 +435,14 @@ typedef struct {
static
BOOL
stringify_push_obj
(
stringify_ctx_t
*
ctx
,
jsdisp_t
*
obj
)
static
BOOL
stringify_push_obj
(
stringify_ctx_t
*
ctx
,
jsdisp_t
*
obj
)
{
{
if
(
!
ctx
->
stack_size
)
{
if
(
!
ctx
->
stack_size
)
{
ctx
->
stack
=
heap_
alloc
(
4
*
sizeof
(
*
ctx
->
stack
));
ctx
->
stack
=
m
alloc
(
4
*
sizeof
(
*
ctx
->
stack
));
if
(
!
ctx
->
stack
)
if
(
!
ctx
->
stack
)
return
FALSE
;
return
FALSE
;
ctx
->
stack_size
=
4
;
ctx
->
stack_size
=
4
;
}
else
if
(
ctx
->
stack_top
==
ctx
->
stack_size
)
{
}
else
if
(
ctx
->
stack_top
==
ctx
->
stack_size
)
{
jsdisp_t
**
new_stack
;
jsdisp_t
**
new_stack
;
new_stack
=
heap_
realloc
(
ctx
->
stack
,
ctx
->
stack_size
*
2
*
sizeof
(
*
ctx
->
stack
));
new_stack
=
realloc
(
ctx
->
stack
,
ctx
->
stack_size
*
2
*
sizeof
(
*
ctx
->
stack
));
if
(
!
new_stack
)
if
(
!
new_stack
)
return
FALSE
;
return
FALSE
;
ctx
->
stack
=
new_stack
;
ctx
->
stack
=
new_stack
;
...
@@ -471,7 +471,7 @@ static BOOL is_on_stack(stringify_ctx_t *ctx, jsdisp_t *obj)
...
@@ -471,7 +471,7 @@ static BOOL is_on_stack(stringify_ctx_t *ctx, jsdisp_t *obj)
static
BOOL
append_string_len
(
stringify_ctx_t
*
ctx
,
const
WCHAR
*
str
,
size_t
len
)
static
BOOL
append_string_len
(
stringify_ctx_t
*
ctx
,
const
WCHAR
*
str
,
size_t
len
)
{
{
if
(
!
ctx
->
buf_size
)
{
if
(
!
ctx
->
buf_size
)
{
ctx
->
buf
=
heap_
alloc
(
len
*
2
*
sizeof
(
WCHAR
));
ctx
->
buf
=
m
alloc
(
len
*
2
*
sizeof
(
WCHAR
));
if
(
!
ctx
->
buf
)
if
(
!
ctx
->
buf
)
return
FALSE
;
return
FALSE
;
ctx
->
buf_size
=
len
*
2
;
ctx
->
buf_size
=
len
*
2
;
...
@@ -480,7 +480,7 @@ static BOOL append_string_len(stringify_ctx_t *ctx, const WCHAR *str, size_t len
...
@@ -480,7 +480,7 @@ static BOOL append_string_len(stringify_ctx_t *ctx, const WCHAR *str, size_t len
size_t
new_size
;
size_t
new_size
;
new_size
=
ctx
->
buf_size
*
2
+
len
;
new_size
=
ctx
->
buf_size
*
2
+
len
;
new_buf
=
heap_
realloc
(
ctx
->
buf
,
new_size
*
sizeof
(
WCHAR
));
new_buf
=
realloc
(
ctx
->
buf
,
new_size
*
sizeof
(
WCHAR
));
if
(
!
new_buf
)
if
(
!
new_buf
)
return
FALSE
;
return
FALSE
;
ctx
->
buf
=
new_buf
;
ctx
->
buf
=
new_buf
;
...
@@ -938,8 +938,8 @@ fail:
...
@@ -938,8 +938,8 @@ fail:
jsdisp_release
(
obj
);
jsdisp_release
(
obj
);
if
(
stringify_ctx
.
replacer
)
if
(
stringify_ctx
.
replacer
)
jsdisp_release
(
stringify_ctx
.
replacer
);
jsdisp_release
(
stringify_ctx
.
replacer
);
heap_
free
(
stringify_ctx
.
buf
);
free
(
stringify_ctx
.
buf
);
heap_
free
(
stringify_ctx
.
stack
);
free
(
stringify_ctx
.
stack
);
return
hres
;
return
hres
;
}
}
...
@@ -962,13 +962,13 @@ HRESULT create_json(script_ctx_t *ctx, jsdisp_t **ret)
...
@@ -962,13 +962,13 @@ HRESULT create_json(script_ctx_t *ctx, jsdisp_t **ret)
jsdisp_t
*
json
;
jsdisp_t
*
json
;
HRESULT
hres
;
HRESULT
hres
;
json
=
heap_alloc_zero
(
sizeof
(
*
json
));
json
=
calloc
(
1
,
sizeof
(
*
json
));
if
(
!
json
)
if
(
!
json
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
hres
=
init_dispex_from_constr
(
json
,
ctx
,
&
JSON_info
,
ctx
->
object_constr
);
hres
=
init_dispex_from_constr
(
json
,
ctx
,
&
JSON_info
,
ctx
->
object_constr
);
if
(
FAILED
(
hres
))
{
if
(
FAILED
(
hres
))
{
heap_
free
(
json
);
free
(
json
);
return
hres
;
return
hres
;
}
}
...
...
dlls/jscript/jsregexp.c
View file @
ae73e09a
...
@@ -149,7 +149,7 @@ HRESULT regexp_match_next(script_ctx_t *ctx, jsdisp_t *dispex,
...
@@ -149,7 +149,7 @@ HRESULT regexp_match_next(script_ctx_t *ctx, jsdisp_t *dispex,
heap_pool_clear
(
mark
);
heap_pool_clear
(
mark
);
if
(
hres
!=
S_OK
&&
(
rem_flags
&
REM_ALLOC_RESULT
))
{
if
(
hres
!=
S_OK
&&
(
rem_flags
&
REM_ALLOC_RESULT
))
{
heap_
free
(
match
);
free
(
match
);
*
ret
=
NULL
;
*
ret
=
NULL
;
}
}
...
@@ -193,11 +193,11 @@ static HRESULT regexp_match(script_ctx_t *ctx, jsdisp_t *dispex, jsstr_t *jsstr,
...
@@ -193,11 +193,11 @@ static HRESULT regexp_match(script_ctx_t *ctx, jsdisp_t *dispex, jsstr_t *jsstr,
if
(
ret
)
{
if
(
ret
)
{
match_result_t
*
old_ret
=
ret
;
match_result_t
*
old_ret
=
ret
;
ret
=
heap_
realloc
(
old_ret
,
(
ret_size
<<=
1
)
*
sizeof
(
match_result_t
));
ret
=
realloc
(
old_ret
,
(
ret_size
<<=
1
)
*
sizeof
(
match_result_t
));
if
(
!
ret
)
if
(
!
ret
)
heap_
free
(
old_ret
);
free
(
old_ret
);
}
else
{
}
else
{
ret
=
heap_
alloc
((
ret_size
=
4
)
*
sizeof
(
match_result_t
));
ret
=
m
alloc
((
ret_size
=
4
)
*
sizeof
(
match_result_t
));
}
}
if
(
!
ret
)
{
if
(
!
ret
)
{
hres
=
E_OUTOFMEMORY
;
hres
=
E_OUTOFMEMORY
;
...
@@ -216,7 +216,7 @@ static HRESULT regexp_match(script_ctx_t *ctx, jsdisp_t *dispex, jsstr_t *jsstr,
...
@@ -216,7 +216,7 @@ static HRESULT regexp_match(script_ctx_t *ctx, jsdisp_t *dispex, jsstr_t *jsstr,
heap_pool_clear
(
mark
);
heap_pool_clear
(
mark
);
if
(
FAILED
(
hres
))
{
if
(
FAILED
(
hres
))
{
heap_
free
(
ret
);
free
(
ret
);
return
hres
;
return
hres
;
}
}
...
@@ -545,7 +545,7 @@ static void RegExp_destructor(jsdisp_t *dispex)
...
@@ -545,7 +545,7 @@ static void RegExp_destructor(jsdisp_t *dispex)
regexp_destroy
(
This
->
jsregexp
);
regexp_destroy
(
This
->
jsregexp
);
jsval_release
(
This
->
last_index_val
);
jsval_release
(
This
->
last_index_val
);
jsstr_release
(
This
->
str
);
jsstr_release
(
This
->
str
);
heap_
free
(
This
);
free
(
This
);
}
}
static
const
builtin_prop_t
RegExp_props
[]
=
{
static
const
builtin_prop_t
RegExp_props
[]
=
{
...
@@ -590,7 +590,7 @@ static HRESULT alloc_regexp(script_ctx_t *ctx, jsdisp_t *object_prototype, RegEx
...
@@ -590,7 +590,7 @@ static HRESULT alloc_regexp(script_ctx_t *ctx, jsdisp_t *object_prototype, RegEx
RegExpInstance
*
regexp
;
RegExpInstance
*
regexp
;
HRESULT
hres
;
HRESULT
hres
;
regexp
=
heap_alloc_zero
(
sizeof
(
RegExpInstance
));
regexp
=
calloc
(
1
,
sizeof
(
RegExpInstance
));
if
(
!
regexp
)
if
(
!
regexp
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -600,7 +600,7 @@ static HRESULT alloc_regexp(script_ctx_t *ctx, jsdisp_t *object_prototype, RegEx
...
@@ -600,7 +600,7 @@ static HRESULT alloc_regexp(script_ctx_t *ctx, jsdisp_t *object_prototype, RegEx
hres
=
init_dispex_from_constr
(
&
regexp
->
dispex
,
ctx
,
&
RegExpInst_info
,
ctx
->
regexp_constr
);
hres
=
init_dispex_from_constr
(
&
regexp
->
dispex
,
ctx
,
&
RegExpInst_info
,
ctx
->
regexp_constr
);
if
(
FAILED
(
hres
))
{
if
(
FAILED
(
hres
))
{
heap_
free
(
regexp
);
free
(
regexp
);
return
hres
;
return
hres
;
}
}
...
@@ -780,7 +780,7 @@ HRESULT regexp_string_match(script_ctx_t *ctx, jsdisp_t *re, jsstr_t *jsstr, jsv
...
@@ -780,7 +780,7 @@ HRESULT regexp_string_match(script_ctx_t *ctx, jsdisp_t *re, jsstr_t *jsstr, jsv
break
;
break
;
}
}
heap_
free
(
match_result
);
free
(
match_result
);
if
(
SUCCEEDED
(
hres
)
&&
r
)
if
(
SUCCEEDED
(
hres
)
&&
r
)
*
r
=
jsval_obj
(
array
);
*
r
=
jsval_obj
(
array
);
...
...
dlls/jscript/jsstr.c
View file @
ae73e09a
...
@@ -45,7 +45,7 @@ void jsstr_free(jsstr_t *str)
...
@@ -45,7 +45,7 @@ void jsstr_free(jsstr_t *str)
{
{
switch
(
jsstr_tag
(
str
))
{
switch
(
jsstr_tag
(
str
))
{
case
JSSTR_HEAP
:
case
JSSTR_HEAP
:
heap_
free
(
jsstr_as_heap
(
str
)
->
buf
);
free
(
jsstr_as_heap
(
str
)
->
buf
);
break
;
break
;
case
JSSTR_ROPE
:
{
case
JSSTR_ROPE
:
{
jsstr_rope_t
*
rope
=
jsstr_as_rope
(
str
);
jsstr_rope_t
*
rope
=
jsstr_as_rope
(
str
);
...
@@ -57,7 +57,7 @@ void jsstr_free(jsstr_t *str)
...
@@ -57,7 +57,7 @@ void jsstr_free(jsstr_t *str)
break
;
break
;
}
}
heap_
free
(
str
);
free
(
str
);
}
}
static
inline
void
jsstr_init
(
jsstr_t
*
str
,
unsigned
len
,
jsstr_tag_t
tag
)
static
inline
void
jsstr_init
(
jsstr_t
*
str
,
unsigned
len
,
jsstr_tag_t
tag
)
...
@@ -73,7 +73,7 @@ jsstr_t *jsstr_alloc_buf(unsigned len, WCHAR **buf)
...
@@ -73,7 +73,7 @@ jsstr_t *jsstr_alloc_buf(unsigned len, WCHAR **buf)
if
(
len
>
JSSTR_MAX_LENGTH
)
if
(
len
>
JSSTR_MAX_LENGTH
)
return
NULL
;
return
NULL
;
ret
=
heap_
alloc
(
FIELD_OFFSET
(
jsstr_inline_t
,
buf
[
len
+
1
]));
ret
=
m
alloc
(
FIELD_OFFSET
(
jsstr_inline_t
,
buf
[
len
+
1
]));
if
(
!
ret
)
if
(
!
ret
)
return
NULL
;
return
NULL
;
...
@@ -234,7 +234,7 @@ jsstr_t *jsstr_concat(jsstr_t *str1, jsstr_t *str2)
...
@@ -234,7 +234,7 @@ jsstr_t *jsstr_concat(jsstr_t *str1, jsstr_t *str2)
if
(
len1
+
len2
>
JSSTR_MAX_LENGTH
)
if
(
len1
+
len2
>
JSSTR_MAX_LENGTH
)
return
NULL
;
return
NULL
;
rope
=
heap_
alloc
(
sizeof
(
*
rope
));
rope
=
m
alloc
(
sizeof
(
*
rope
));
if
(
!
rope
)
if
(
!
rope
)
return
NULL
;
return
NULL
;
...
@@ -262,7 +262,7 @@ const WCHAR *jsstr_rope_flatten(jsstr_rope_t *str)
...
@@ -262,7 +262,7 @@ const WCHAR *jsstr_rope_flatten(jsstr_rope_t *str)
{
{
WCHAR
*
buf
;
WCHAR
*
buf
;
buf
=
heap_
alloc
((
jsstr_length
(
&
str
->
str
)
+
1
)
*
sizeof
(
WCHAR
));
buf
=
m
alloc
((
jsstr_length
(
&
str
->
str
)
+
1
)
*
sizeof
(
WCHAR
));
if
(
!
buf
)
if
(
!
buf
)
return
NULL
;
return
NULL
;
...
...
dlls/jscript/jsutils.c
View file @
ae73e09a
...
@@ -72,12 +72,12 @@ void *heap_pool_alloc(heap_pool_t *heap, DWORD size)
...
@@ -72,12 +72,12 @@ void *heap_pool_alloc(heap_pool_t *heap, DWORD size)
if
(
!
heap
->
block_cnt
)
{
if
(
!
heap
->
block_cnt
)
{
if
(
!
heap
->
blocks
)
{
if
(
!
heap
->
blocks
)
{
heap
->
blocks
=
heap_
alloc
(
sizeof
(
void
*
));
heap
->
blocks
=
m
alloc
(
sizeof
(
void
*
));
if
(
!
heap
->
blocks
)
if
(
!
heap
->
blocks
)
return
NULL
;
return
NULL
;
}
}
tmp
=
heap_
alloc
(
block_size
(
0
));
tmp
=
m
alloc
(
block_size
(
0
));
if
(
!
tmp
)
if
(
!
tmp
)
return
NULL
;
return
NULL
;
...
@@ -93,12 +93,12 @@ void *heap_pool_alloc(heap_pool_t *heap, DWORD size)
...
@@ -93,12 +93,12 @@ void *heap_pool_alloc(heap_pool_t *heap, DWORD size)
if
(
size
<=
block_size
(
heap
->
last_block
+
1
))
{
if
(
size
<=
block_size
(
heap
->
last_block
+
1
))
{
if
(
heap
->
last_block
+
1
==
heap
->
block_cnt
)
{
if
(
heap
->
last_block
+
1
==
heap
->
block_cnt
)
{
tmp
=
heap_
realloc
(
heap
->
blocks
,
(
heap
->
block_cnt
+
1
)
*
sizeof
(
void
*
));
tmp
=
realloc
(
heap
->
blocks
,
(
heap
->
block_cnt
+
1
)
*
sizeof
(
void
*
));
if
(
!
tmp
)
if
(
!
tmp
)
return
NULL
;
return
NULL
;
heap
->
blocks
=
tmp
;
heap
->
blocks
=
tmp
;
heap
->
blocks
[
heap
->
block_cnt
]
=
heap_
alloc
(
block_size
(
heap
->
block_cnt
));
heap
->
blocks
[
heap
->
block_cnt
]
=
m
alloc
(
block_size
(
heap
->
block_cnt
));
if
(
!
heap
->
blocks
[
heap
->
block_cnt
])
if
(
!
heap
->
blocks
[
heap
->
block_cnt
])
return
NULL
;
return
NULL
;
...
@@ -110,7 +110,7 @@ void *heap_pool_alloc(heap_pool_t *heap, DWORD size)
...
@@ -110,7 +110,7 @@ void *heap_pool_alloc(heap_pool_t *heap, DWORD size)
return
heap
->
blocks
[
heap
->
last_block
];
return
heap
->
blocks
[
heap
->
last_block
];
}
}
list
=
heap_
alloc
(
size
+
sizeof
(
struct
list
));
list
=
m
alloc
(
size
+
sizeof
(
struct
list
));
if
(
!
list
)
if
(
!
list
)
return
NULL
;
return
NULL
;
...
@@ -143,7 +143,7 @@ void heap_pool_clear(heap_pool_t *heap)
...
@@ -143,7 +143,7 @@ void heap_pool_clear(heap_pool_t *heap)
while
((
tmp
=
list_head
(
&
heap
->
custom_blocks
)))
{
while
((
tmp
=
list_head
(
&
heap
->
custom_blocks
)))
{
list_remove
(
tmp
);
list_remove
(
tmp
);
heap_
free
(
tmp
);
free
(
tmp
);
}
}
if
(
WARN_ON
(
heap
))
{
if
(
WARN_ON
(
heap
))
{
...
@@ -164,8 +164,8 @@ void heap_pool_free(heap_pool_t *heap)
...
@@ -164,8 +164,8 @@ void heap_pool_free(heap_pool_t *heap)
heap_pool_clear
(
heap
);
heap_pool_clear
(
heap
);
for
(
i
=
0
;
i
<
heap
->
block_cnt
;
i
++
)
for
(
i
=
0
;
i
<
heap
->
block_cnt
;
i
++
)
heap_
free
(
heap
->
blocks
[
i
]);
free
(
heap
->
blocks
[
i
]);
heap_
free
(
heap
->
blocks
);
free
(
heap
->
blocks
);
heap_pool_init
(
heap
);
heap_pool_init
(
heap
);
}
}
...
@@ -190,7 +190,7 @@ void jsval_release(jsval_t val)
...
@@ -190,7 +190,7 @@ void jsval_release(jsval_t val)
break
;
break
;
case
JSV_VARIANT
:
case
JSV_VARIANT
:
VariantClear
(
get_variant
(
val
));
VariantClear
(
get_variant
(
val
));
heap_
free
(
get_variant
(
val
));
free
(
get_variant
(
val
));
break
;
break
;
default:
default:
break
;
break
;
...
@@ -203,7 +203,7 @@ static HRESULT jsval_variant(jsval_t *val, VARIANT *var)
...
@@ -203,7 +203,7 @@ static HRESULT jsval_variant(jsval_t *val, VARIANT *var)
HRESULT
hres
;
HRESULT
hres
;
__JSVAL_TYPE
(
*
val
)
=
JSV_VARIANT
;
__JSVAL_TYPE
(
*
val
)
=
JSV_VARIANT
;
__JSVAL_VAR
(
*
val
)
=
v
=
heap_
alloc
(
sizeof
(
VARIANT
));
__JSVAL_VAR
(
*
val
)
=
v
=
m
alloc
(
sizeof
(
VARIANT
));
if
(
!
v
)
{
if
(
!
v
)
{
*
val
=
jsval_undefined
();
*
val
=
jsval_undefined
();
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -213,7 +213,7 @@ static HRESULT jsval_variant(jsval_t *val, VARIANT *var)
...
@@ -213,7 +213,7 @@ static HRESULT jsval_variant(jsval_t *val, VARIANT *var)
hres
=
VariantCopy
(
v
,
var
);
hres
=
VariantCopy
(
v
,
var
);
if
(
FAILED
(
hres
))
{
if
(
FAILED
(
hres
))
{
*
val
=
jsval_undefined
();
*
val
=
jsval_undefined
();
heap_
free
(
v
);
free
(
v
);
}
}
return
hres
;
return
hres
;
}
}
...
@@ -1023,7 +1023,7 @@ static ULONG WINAPI JSCaller_Release(IServiceProvider *iface)
...
@@ -1023,7 +1023,7 @@ static ULONG WINAPI JSCaller_Release(IServiceProvider *iface)
if
(
!
ref
)
{
if
(
!
ref
)
{
assert
(
!
This
->
ctx
);
assert
(
!
This
->
ctx
);
heap_
free
(
This
);
free
(
This
);
}
}
return
ref
;
return
ref
;
...
@@ -1056,7 +1056,7 @@ HRESULT create_jscaller(script_ctx_t *ctx)
...
@@ -1056,7 +1056,7 @@ HRESULT create_jscaller(script_ctx_t *ctx)
{
{
JSCaller
*
ret
;
JSCaller
*
ret
;
ret
=
heap_
alloc
(
sizeof
(
*
ret
));
ret
=
m
alloc
(
sizeof
(
*
ret
));
if
(
!
ret
)
if
(
!
ret
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
...
dlls/jscript/lex.c
View file @
ae73e09a
...
@@ -820,10 +820,10 @@ void release_cc(cc_ctx_t *cc)
...
@@ -820,10 +820,10 @@ void release_cc(cc_ctx_t *cc)
for
(
iter
=
cc
->
vars
;
iter
;
iter
=
next
)
{
for
(
iter
=
cc
->
vars
;
iter
;
iter
=
next
)
{
next
=
iter
->
next
;
next
=
iter
->
next
;
heap_
free
(
iter
);
free
(
iter
);
}
}
heap_
free
(
cc
);
free
(
cc
);
}
}
static
BOOL
new_cc_var
(
cc_ctx_t
*
cc
,
const
WCHAR
*
name
,
int
len
,
ccval_t
v
)
static
BOOL
new_cc_var
(
cc_ctx_t
*
cc
,
const
WCHAR
*
name
,
int
len
,
ccval_t
v
)
...
@@ -833,7 +833,7 @@ static BOOL new_cc_var(cc_ctx_t *cc, const WCHAR *name, int len, ccval_t v)
...
@@ -833,7 +833,7 @@ static BOOL new_cc_var(cc_ctx_t *cc, const WCHAR *name, int len, ccval_t v)
if
(
len
==
-
1
)
if
(
len
==
-
1
)
len
=
lstrlenW
(
name
);
len
=
lstrlenW
(
name
);
new_v
=
heap_
alloc
(
sizeof
(
cc_var_t
)
+
(
len
+
1
)
*
sizeof
(
WCHAR
));
new_v
=
m
alloc
(
sizeof
(
cc_var_t
)
+
(
len
+
1
)
*
sizeof
(
WCHAR
));
if
(
!
new_v
)
if
(
!
new_v
)
return
FALSE
;
return
FALSE
;
...
@@ -864,7 +864,7 @@ static BOOL init_cc(parser_ctx_t *ctx)
...
@@ -864,7 +864,7 @@ static BOOL init_cc(parser_ctx_t *ctx)
if
(
ctx
->
script
->
cc
)
if
(
ctx
->
script
->
cc
)
return
TRUE
;
return
TRUE
;
cc
=
heap_
alloc
(
sizeof
(
cc_ctx_t
));
cc
=
m
alloc
(
sizeof
(
cc_ctx_t
));
if
(
!
cc
)
{
if
(
!
cc
)
{
lex_error
(
ctx
,
E_OUTOFMEMORY
);
lex_error
(
ctx
,
E_OUTOFMEMORY
);
return
FALSE
;
return
FALSE
;
...
...
dlls/jscript/math.c
View file @
ae73e09a
...
@@ -519,13 +519,13 @@ HRESULT create_math(script_ctx_t *ctx, jsdisp_t **ret)
...
@@ -519,13 +519,13 @@ HRESULT create_math(script_ctx_t *ctx, jsdisp_t **ret)
{
L"SQRT2"
,
M_SQRT2
},
/* ECMA-262 3rd Edition 15.8.1.8 */
{
L"SQRT2"
,
M_SQRT2
},
/* ECMA-262 3rd Edition 15.8.1.8 */
};
};
math
=
heap_alloc_zero
(
sizeof
(
jsdisp_t
));
math
=
calloc
(
1
,
sizeof
(
jsdisp_t
));
if
(
!
math
)
if
(
!
math
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
hres
=
init_dispex_from_constr
(
math
,
ctx
,
&
Math_info
,
ctx
->
object_constr
);
hres
=
init_dispex_from_constr
(
math
,
ctx
,
&
Math_info
,
ctx
->
object_constr
);
if
(
FAILED
(
hres
))
{
if
(
FAILED
(
hres
))
{
heap_
free
(
math
);
free
(
math
);
return
hres
;
return
hres
;
}
}
...
...
dlls/jscript/number.c
View file @
ae73e09a
...
@@ -658,7 +658,7 @@ static HRESULT alloc_number(script_ctx_t *ctx, jsdisp_t *object_prototype, Numbe
...
@@ -658,7 +658,7 @@ static HRESULT alloc_number(script_ctx_t *ctx, jsdisp_t *object_prototype, Numbe
NumberInstance
*
number
;
NumberInstance
*
number
;
HRESULT
hres
;
HRESULT
hres
;
number
=
heap_alloc_zero
(
sizeof
(
NumberInstance
));
number
=
calloc
(
1
,
sizeof
(
NumberInstance
));
if
(
!
number
)
if
(
!
number
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -667,7 +667,7 @@ static HRESULT alloc_number(script_ctx_t *ctx, jsdisp_t *object_prototype, Numbe
...
@@ -667,7 +667,7 @@ static HRESULT alloc_number(script_ctx_t *ctx, jsdisp_t *object_prototype, Numbe
else
else
hres
=
init_dispex_from_constr
(
&
number
->
dispex
,
ctx
,
&
NumberInst_info
,
ctx
->
number_constr
);
hres
=
init_dispex_from_constr
(
&
number
->
dispex
,
ctx
,
&
NumberInst_info
,
ctx
->
number_constr
);
if
(
FAILED
(
hres
))
{
if
(
FAILED
(
hres
))
{
heap_
free
(
number
);
free
(
number
);
return
hres
;
return
hres
;
}
}
...
...
dlls/jscript/object.c
View file @
ae73e09a
...
@@ -447,7 +447,7 @@ done:
...
@@ -447,7 +447,7 @@ done:
static
void
Object_destructor
(
jsdisp_t
*
dispex
)
static
void
Object_destructor
(
jsdisp_t
*
dispex
)
{
{
heap_
free
(
dispex
);
free
(
dispex
);
}
}
static
const
builtin_prop_t
Object_props
[]
=
{
static
const
builtin_prop_t
Object_props
[]
=
{
...
@@ -1137,13 +1137,13 @@ HRESULT create_object(script_ctx_t *ctx, jsdisp_t *constr, jsdisp_t **ret)
...
@@ -1137,13 +1137,13 @@ HRESULT create_object(script_ctx_t *ctx, jsdisp_t *constr, jsdisp_t **ret)
jsdisp_t
*
object
;
jsdisp_t
*
object
;
HRESULT
hres
;
HRESULT
hres
;
object
=
heap_alloc_zero
(
sizeof
(
jsdisp_t
));
object
=
calloc
(
1
,
sizeof
(
jsdisp_t
));
if
(
!
object
)
if
(
!
object
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
hres
=
init_dispex_from_constr
(
object
,
ctx
,
&
ObjectInst_info
,
constr
?
constr
:
ctx
->
object_constr
);
hres
=
init_dispex_from_constr
(
object
,
ctx
,
&
ObjectInst_info
,
constr
?
constr
:
ctx
->
object_constr
);
if
(
FAILED
(
hres
))
{
if
(
FAILED
(
hres
))
{
heap_
free
(
object
);
free
(
object
);
return
hres
;
return
hres
;
}
}
...
...
dlls/jscript/parser.y
View file @
ae73e09a
...
@@ -1604,7 +1604,7 @@ void parser_release(parser_ctx_t *ctx)
...
@@ -1604,7 +1604,7 @@ void parser_release(parser_ctx_t *ctx)
{
{
script_release(ctx->script);
script_release(ctx->script);
heap_pool_free(&ctx->heap);
heap_pool_free(&ctx->heap);
heap_
free(ctx);
free(ctx);
}
}
HRESULT script_parse(script_ctx_t *ctx, struct _compiler_ctx_t *compiler, bytecode_t *code, const WCHAR *delimiter, BOOL from_eval,
HRESULT script_parse(script_ctx_t *ctx, struct _compiler_ctx_t *compiler, bytecode_t *code, const WCHAR *delimiter, BOOL from_eval,
...
@@ -1614,7 +1614,7 @@ HRESULT script_parse(script_ctx_t *ctx, struct _compiler_ctx_t *compiler, byteco
...
@@ -1614,7 +1614,7 @@ HRESULT script_parse(script_ctx_t *ctx, struct _compiler_ctx_t *compiler, byteco
heap_pool_t *mark;
heap_pool_t *mark;
HRESULT hres;
HRESULT hres;
parser_ctx =
heap_alloc_zero(
sizeof(parser_ctx_t));
parser_ctx =
calloc(1,
sizeof(parser_ctx_t));
if(!parser_ctx)
if(!parser_ctx)
return E_OUTOFMEMORY;
return E_OUTOFMEMORY;
...
...
dlls/jscript/regexp.c
View file @
ae73e09a
...
@@ -482,7 +482,7 @@ EmitREBytecode(CompilerState *state, regexp_t *re, size_t treeDepth,
...
@@ -482,7 +482,7 @@ EmitREBytecode(CompilerState *state, regexp_t *re, size_t treeDepth,
if
(
treeDepth
==
0
)
{
if
(
treeDepth
==
0
)
{
emitStateStack
=
NULL
;
emitStateStack
=
NULL
;
}
else
{
}
else
{
emitStateStack
=
heap_
alloc
(
sizeof
(
EmitStateStackEntry
)
*
treeDepth
);
emitStateStack
=
m
alloc
(
sizeof
(
EmitStateStackEntry
)
*
treeDepth
);
if
(
!
emitStateStack
)
if
(
!
emitStateStack
)
return
NULL
;
return
NULL
;
}
}
...
@@ -788,7 +788,7 @@ EmitREBytecode(CompilerState *state, regexp_t *re, size_t treeDepth,
...
@@ -788,7 +788,7 @@ EmitREBytecode(CompilerState *state, regexp_t *re, size_t treeDepth,
}
}
cleanup:
cleanup:
heap_
free
(
emitStateStack
);
free
(
emitStateStack
);
return
pc
;
return
pc
;
jump_too_big:
jump_too_big:
...
@@ -1667,11 +1667,11 @@ ParseRegExp(CompilerState *state)
...
@@ -1667,11 +1667,11 @@ ParseRegExp(CompilerState *state)
return
(
state
->
result
!=
NULL
);
return
(
state
->
result
!=
NULL
);
}
}
operatorStack
=
heap_
alloc
(
sizeof
(
REOpData
)
*
operatorStackSize
);
operatorStack
=
m
alloc
(
sizeof
(
REOpData
)
*
operatorStackSize
);
if
(
!
operatorStack
)
if
(
!
operatorStack
)
return
FALSE
;
return
FALSE
;
operandStack
=
heap_
alloc
(
sizeof
(
RENode
*
)
*
operandStackSize
);
operandStack
=
m
alloc
(
sizeof
(
RENode
*
)
*
operandStackSize
);
if
(
!
operandStack
)
if
(
!
operandStack
)
goto
out
;
goto
out
;
...
@@ -1762,7 +1762,7 @@ pushOperand:
...
@@ -1762,7 +1762,7 @@ pushOperand:
if
(
operandSP
==
operandStackSize
)
{
if
(
operandSP
==
operandStackSize
)
{
RENode
**
tmp
;
RENode
**
tmp
;
operandStackSize
+=
operandStackSize
;
operandStackSize
+=
operandStackSize
;
tmp
=
heap_
realloc
(
operandStack
,
sizeof
(
RENode
*
)
*
operandStackSize
);
tmp
=
realloc
(
operandStack
,
sizeof
(
RENode
*
)
*
operandStackSize
);
if
(
!
tmp
)
if
(
!
tmp
)
goto
out
;
goto
out
;
operandStack
=
tmp
;
operandStack
=
tmp
;
...
@@ -1895,7 +1895,7 @@ pushOperator:
...
@@ -1895,7 +1895,7 @@ pushOperator:
if
(
operatorSP
==
operatorStackSize
)
{
if
(
operatorSP
==
operatorStackSize
)
{
REOpData
*
tmp
;
REOpData
*
tmp
;
operatorStackSize
+=
operatorStackSize
;
operatorStackSize
+=
operatorStackSize
;
tmp
=
heap_
realloc
(
operatorStack
,
sizeof
(
REOpData
)
*
operatorStackSize
);
tmp
=
realloc
(
operatorStack
,
sizeof
(
REOpData
)
*
operatorStackSize
);
if
(
!
tmp
)
if
(
!
tmp
)
goto
out
;
goto
out
;
operatorStack
=
tmp
;
operatorStack
=
tmp
;
...
@@ -1907,8 +1907,8 @@ pushOperator:
...
@@ -1907,8 +1907,8 @@ pushOperator:
}
}
}
}
out:
out:
heap_
free
(
operatorStack
);
free
(
operatorStack
);
heap_
free
(
operandStack
);
free
(
operandStack
);
return
result
;
return
result
;
}
}
...
@@ -2111,7 +2111,7 @@ ProcessCharSet(REGlobalData *gData, RECharSet *charSet)
...
@@ -2111,7 +2111,7 @@ ProcessCharSet(REGlobalData *gData, RECharSet *charSet)
assert
(
src
[
-
1
]
==
'['
&&
end
[
0
]
==
']'
);
assert
(
src
[
-
1
]
==
'['
&&
end
[
0
]
==
']'
);
byteLength
=
(
charSet
->
length
>>
3
)
+
1
;
byteLength
=
(
charSet
->
length
>>
3
)
+
1
;
charSet
->
u
.
bits
=
heap_
alloc
(
byteLength
);
charSet
->
u
.
bits
=
m
alloc
(
byteLength
);
if
(
!
charSet
->
u
.
bits
)
{
if
(
!
charSet
->
u
.
bits
)
{
JS_ReportOutOfMemory
(
gData
->
cx
);
JS_ReportOutOfMemory
(
gData
->
cx
);
gData
->
ok
=
FALSE
;
gData
->
ok
=
FALSE
;
...
@@ -3184,12 +3184,12 @@ void regexp_destroy(regexp_t *re)
...
@@ -3184,12 +3184,12 @@ void regexp_destroy(regexp_t *re)
UINT
i
;
UINT
i
;
for
(
i
=
0
;
i
<
re
->
classCount
;
i
++
)
{
for
(
i
=
0
;
i
<
re
->
classCount
;
i
++
)
{
if
(
re
->
classList
[
i
].
converted
)
if
(
re
->
classList
[
i
].
converted
)
heap_
free
(
re
->
classList
[
i
].
u
.
bits
);
free
(
re
->
classList
[
i
].
u
.
bits
);
re
->
classList
[
i
].
u
.
bits
=
NULL
;
re
->
classList
[
i
].
u
.
bits
=
NULL
;
}
}
heap_
free
(
re
->
classList
);
free
(
re
->
classList
);
}
}
heap_
free
(
re
);
free
(
re
);
}
}
regexp_t
*
regexp_new
(
void
*
cx
,
heap_pool_t
*
pool
,
const
WCHAR
*
str
,
regexp_t
*
regexp_new
(
void
*
cx
,
heap_pool_t
*
pool
,
const
WCHAR
*
str
,
...
@@ -3238,14 +3238,14 @@ regexp_t* regexp_new(void *cx, heap_pool_t *pool, const WCHAR *str,
...
@@ -3238,14 +3238,14 @@ regexp_t* regexp_new(void *cx, heap_pool_t *pool, const WCHAR *str,
goto
out
;
goto
out
;
}
}
resize
=
offsetof
(
regexp_t
,
program
)
+
state
.
progLength
+
1
;
resize
=
offsetof
(
regexp_t
,
program
)
+
state
.
progLength
+
1
;
re
=
heap_
alloc
(
resize
);
re
=
m
alloc
(
resize
);
if
(
!
re
)
if
(
!
re
)
goto
out
;
goto
out
;
assert
(
state
.
classBitmapsMem
<=
CLASS_BITMAPS_MEM_LIMIT
);
assert
(
state
.
classBitmapsMem
<=
CLASS_BITMAPS_MEM_LIMIT
);
re
->
classCount
=
state
.
classCount
;
re
->
classCount
=
state
.
classCount
;
if
(
re
->
classCount
)
{
if
(
re
->
classCount
)
{
re
->
classList
=
heap_
alloc
(
re
->
classCount
*
sizeof
(
RECharSet
));
re
->
classList
=
m
alloc
(
re
->
classCount
*
sizeof
(
RECharSet
));
if
(
!
re
->
classList
)
{
if
(
!
re
->
classList
)
{
regexp_destroy
(
re
);
regexp_destroy
(
re
);
re
=
NULL
;
re
=
NULL
;
...
@@ -3272,7 +3272,7 @@ regexp_t* regexp_new(void *cx, heap_pool_t *pool, const WCHAR *str,
...
@@ -3272,7 +3272,7 @@ regexp_t* regexp_new(void *cx, heap_pool_t *pool, const WCHAR *str,
regexp_t
*
tmp
;
regexp_t
*
tmp
;
assert
((
size_t
)(
endPC
-
re
->
program
)
<
state
.
progLength
+
1
);
assert
((
size_t
)(
endPC
-
re
->
program
)
<
state
.
progLength
+
1
);
resize
=
offsetof
(
regexp_t
,
program
)
+
(
endPC
-
re
->
program
);
resize
=
offsetof
(
regexp_t
,
program
)
+
(
endPC
-
re
->
program
);
tmp
=
heap_
realloc
(
re
,
resize
);
tmp
=
realloc
(
re
,
resize
);
if
(
tmp
)
if
(
tmp
)
re
=
tmp
;
re
=
tmp
;
}
}
...
...
dlls/jscript/regexp.h
View file @
ae73e09a
...
@@ -72,7 +72,7 @@ static inline match_state_t* alloc_match_state(regexp_t *regexp,
...
@@ -72,7 +72,7 @@ static inline match_state_t* alloc_match_state(regexp_t *regexp,
size_t
size
=
offsetof
(
match_state_t
,
parens
)
+
regexp
->
parenCount
*
sizeof
(
RECapture
);
size_t
size
=
offsetof
(
match_state_t
,
parens
)
+
regexp
->
parenCount
*
sizeof
(
RECapture
);
match_state_t
*
ret
;
match_state_t
*
ret
;
ret
=
pool
?
heap_pool_alloc
(
pool
,
size
)
:
heap_
alloc
(
size
);
ret
=
pool
?
heap_pool_alloc
(
pool
,
size
)
:
m
alloc
(
size
);
if
(
!
ret
)
if
(
!
ret
)
return
NULL
;
return
NULL
;
...
...
dlls/jscript/set.c
View file @
ae73e09a
...
@@ -134,7 +134,7 @@ static void release_map_entry(struct jsval_map_entry *entry)
...
@@ -134,7 +134,7 @@ static void release_map_entry(struct jsval_map_entry *entry)
jsval_release
(
entry
->
key
);
jsval_release
(
entry
->
key
);
jsval_release
(
entry
->
value
);
jsval_release
(
entry
->
value
);
list_remove
(
&
entry
->
list_entry
);
list_remove
(
&
entry
->
list_entry
);
heap_
free
(
entry
);
free
(
entry
);
}
}
static
void
delete_map_entry
(
MapInstance
*
map
,
struct
jsval_map_entry
*
entry
)
static
void
delete_map_entry
(
MapInstance
*
map
,
struct
jsval_map_entry
*
entry
)
...
@@ -159,7 +159,7 @@ static HRESULT set_map_entry(MapInstance *map, jsval_t key, jsval_t value, jsval
...
@@ -159,7 +159,7 @@ static HRESULT set_map_entry(MapInstance *map, jsval_t key, jsval_t value, jsval
jsval_release
(
entry
->
value
);
jsval_release
(
entry
->
value
);
entry
->
value
=
val
;
entry
->
value
=
val
;
}
else
{
}
else
{
if
(
!
(
entry
=
heap_alloc_zero
(
sizeof
(
*
entry
))))
return
E_OUTOFMEMORY
;
if
(
!
(
entry
=
calloc
(
1
,
sizeof
(
*
entry
))))
return
E_OUTOFMEMORY
;
hres
=
jsval_copy
(
key
,
&
entry
->
key
);
hres
=
jsval_copy
(
key
,
&
entry
->
key
);
if
(
SUCCEEDED
(
hres
))
{
if
(
SUCCEEDED
(
hres
))
{
...
@@ -168,7 +168,7 @@ static HRESULT set_map_entry(MapInstance *map, jsval_t key, jsval_t value, jsval
...
@@ -168,7 +168,7 @@ static HRESULT set_map_entry(MapInstance *map, jsval_t key, jsval_t value, jsval
jsval_release
(
entry
->
key
);
jsval_release
(
entry
->
key
);
}
}
if
(
FAILED
(
hres
))
{
if
(
FAILED
(
hres
))
{
heap_
free
(
entry
);
free
(
entry
);
return
hres
;
return
hres
;
}
}
grab_map_entry
(
entry
);
grab_map_entry
(
entry
);
...
@@ -366,7 +366,7 @@ static void Map_destructor(jsdisp_t *dispex)
...
@@ -366,7 +366,7 @@ static void Map_destructor(jsdisp_t *dispex)
release_map_entry
(
entry
);
release_map_entry
(
entry
);
}
}
heap_
free
(
map
);
free
(
map
);
}
}
static
const
builtin_prop_t
Map_prototype_props
[]
=
{
static
const
builtin_prop_t
Map_prototype_props
[]
=
{
{
L"clear"
,
Map_clear
,
PROPF_METHOD
},
{
L"clear"
,
Map_clear
,
PROPF_METHOD
},
...
@@ -411,7 +411,7 @@ static HRESULT Map_constructor(script_ctx_t *ctx, jsval_t vthis, WORD flags, uns
...
@@ -411,7 +411,7 @@ static HRESULT Map_constructor(script_ctx_t *ctx, jsval_t vthis, WORD flags, uns
if
(
!
r
)
if
(
!
r
)
return
S_OK
;
return
S_OK
;
if
(
!
(
map
=
heap_alloc_zero
(
sizeof
(
*
map
))))
if
(
!
(
map
=
calloc
(
1
,
sizeof
(
*
map
))))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
hres
=
init_dispex
(
&
map
->
dispex
,
ctx
,
&
Map_info
,
ctx
->
map_prototype
);
hres
=
init_dispex
(
&
map
->
dispex
,
ctx
,
&
Map_info
,
ctx
->
map_prototype
);
...
@@ -563,7 +563,7 @@ static HRESULT Set_constructor(script_ctx_t *ctx, jsval_t vthis, WORD flags, uns
...
@@ -563,7 +563,7 @@ static HRESULT Set_constructor(script_ctx_t *ctx, jsval_t vthis, WORD flags, uns
if
(
!
r
)
if
(
!
r
)
return
S_OK
;
return
S_OK
;
if
(
!
(
set
=
heap_alloc_zero
(
sizeof
(
*
set
))))
if
(
!
(
set
=
calloc
(
1
,
sizeof
(
*
set
))))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
hres
=
init_dispex
(
&
set
->
dispex
,
ctx
,
&
Set_info
,
ctx
->
set_prototype
);
hres
=
init_dispex
(
&
set
->
dispex
,
ctx
,
&
Set_info
,
ctx
->
set_prototype
);
...
...
dlls/jscript/string.c
View file @
ae73e09a
...
@@ -362,7 +362,7 @@ static HRESULT String_concat(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsig
...
@@ -362,7 +362,7 @@ static HRESULT String_concat(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsig
jsstr_t
**
strs
;
jsstr_t
**
strs
;
WCHAR
*
ptr
;
WCHAR
*
ptr
;
strs
=
heap_alloc_zero
(
str_cnt
*
sizeof
(
*
strs
));
strs
=
calloc
(
str_cnt
,
sizeof
(
*
strs
));
if
(
!
strs
)
{
if
(
!
strs
)
{
jsstr_release
(
str
);
jsstr_release
(
str
);
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -397,7 +397,7 @@ static HRESULT String_concat(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsig
...
@@ -397,7 +397,7 @@ static HRESULT String_concat(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsig
while
(
i
--
)
while
(
i
--
)
jsstr_release
(
strs
[
i
]);
jsstr_release
(
strs
[
i
]);
heap_
free
(
strs
);
free
(
strs
);
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
}
}
...
@@ -628,9 +628,9 @@ static BOOL strbuf_ensure_size(strbuf_t *buf, unsigned len)
...
@@ -628,9 +628,9 @@ static BOOL strbuf_ensure_size(strbuf_t *buf, unsigned len)
if
(
new_size
<
len
)
if
(
new_size
<
len
)
new_size
=
len
;
new_size
=
len
;
if
(
buf
->
buf
)
if
(
buf
->
buf
)
new_buf
=
heap_
realloc
(
buf
->
buf
,
new_size
*
sizeof
(
WCHAR
));
new_buf
=
realloc
(
buf
->
buf
,
new_size
*
sizeof
(
WCHAR
));
else
else
new_buf
=
heap_
alloc
(
new_size
*
sizeof
(
WCHAR
));
new_buf
=
m
alloc
(
new_size
*
sizeof
(
WCHAR
));
if
(
!
new_buf
)
if
(
!
new_buf
)
return
FALSE
;
return
FALSE
;
...
@@ -673,7 +673,7 @@ static HRESULT rep_call(script_ctx_t *ctx, jsdisp_t *func,
...
@@ -673,7 +673,7 @@ static HRESULT rep_call(script_ctx_t *ctx, jsdisp_t *func,
HRESULT
hres
=
S_OK
;
HRESULT
hres
=
S_OK
;
argc
=
match
->
paren_count
+
3
;
argc
=
match
->
paren_count
+
3
;
argv
=
heap_alloc_zero
(
sizeof
(
*
argv
)
*
argc
);
argv
=
calloc
(
argc
,
sizeof
(
*
argv
)
);
if
(
!
argv
)
if
(
!
argv
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -706,7 +706,7 @@ static HRESULT rep_call(script_ctx_t *ctx, jsdisp_t *func,
...
@@ -706,7 +706,7 @@ static HRESULT rep_call(script_ctx_t *ctx, jsdisp_t *func,
for
(
i
=
0
;
i
<=
match
->
paren_count
;
i
++
)
for
(
i
=
0
;
i
<=
match
->
paren_count
;
i
++
)
jsstr_release
(
get_string
(
argv
[
i
]));
jsstr_release
(
get_string
(
argv
[
i
]));
heap_
free
(
argv
);
free
(
argv
);
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
...
@@ -909,7 +909,7 @@ static HRESULT String_replace(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsi
...
@@ -909,7 +909,7 @@ static HRESULT String_replace(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsi
if
(
match_str
)
if
(
match_str
)
jsstr_release
(
match_jsstr
);
jsstr_release
(
match_jsstr
);
if
(
regexp
)
if
(
regexp
)
heap_
free
(
match
);
free
(
match
);
if
(
SUCCEEDED
(
hres
)
&&
last_match
.
cp
&&
regexp
)
{
if
(
SUCCEEDED
(
hres
)
&&
last_match
.
cp
&&
regexp
)
{
jsstr_release
(
ctx
->
last_match
);
jsstr_release
(
ctx
->
last_match
);
...
@@ -933,7 +933,7 @@ static HRESULT String_replace(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsi
...
@@ -933,7 +933,7 @@ static HRESULT String_replace(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsi
*
r
=
jsval_string
(
ret_str
);
*
r
=
jsval_string
(
ret_str
);
}
}
heap_
free
(
ret
.
buf
);
free
(
ret
.
buf
);
return
hres
;
return
hres
;
}
}
...
@@ -1500,7 +1500,7 @@ static void String_destructor(jsdisp_t *dispex)
...
@@ -1500,7 +1500,7 @@ static void String_destructor(jsdisp_t *dispex)
StringInstance
*
This
=
string_from_jsdisp
(
dispex
);
StringInstance
*
This
=
string_from_jsdisp
(
dispex
);
jsstr_release
(
This
->
str
);
jsstr_release
(
This
->
str
);
heap_
free
(
This
);
free
(
This
);
}
}
static
unsigned
String_idx_length
(
jsdisp_t
*
jsdisp
)
static
unsigned
String_idx_length
(
jsdisp_t
*
jsdisp
)
...
@@ -1681,7 +1681,7 @@ static HRESULT string_alloc(script_ctx_t *ctx, jsdisp_t *object_prototype, jsstr
...
@@ -1681,7 +1681,7 @@ static HRESULT string_alloc(script_ctx_t *ctx, jsdisp_t *object_prototype, jsstr
StringInstance
*
string
;
StringInstance
*
string
;
HRESULT
hres
;
HRESULT
hres
;
string
=
heap_alloc_zero
(
sizeof
(
StringInstance
));
string
=
calloc
(
1
,
sizeof
(
StringInstance
));
if
(
!
string
)
if
(
!
string
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -1690,7 +1690,7 @@ static HRESULT string_alloc(script_ctx_t *ctx, jsdisp_t *object_prototype, jsstr
...
@@ -1690,7 +1690,7 @@ static HRESULT string_alloc(script_ctx_t *ctx, jsdisp_t *object_prototype, jsstr
else
else
hres
=
init_dispex_from_constr
(
&
string
->
dispex
,
ctx
,
&
StringInst_info
,
ctx
->
string_constr
);
hres
=
init_dispex_from_constr
(
&
string
->
dispex
,
ctx
,
&
StringInst_info
,
ctx
->
string_constr
);
if
(
FAILED
(
hres
))
{
if
(
FAILED
(
hres
))
{
heap_
free
(
string
);
free
(
string
);
return
hres
;
return
hres
;
}
}
...
...
dlls/jscript/vbarray.c
View file @
ae73e09a
...
@@ -73,20 +73,20 @@ static HRESULT VBArray_getItem(script_ctx_t *ctx, jsval_t vthis, WORD flags, uns
...
@@ -73,20 +73,20 @@ static HRESULT VBArray_getItem(script_ctx_t *ctx, jsval_t vthis, WORD flags, uns
if
(
argc
<
SafeArrayGetDim
(
vbarray
->
safearray
))
if
(
argc
<
SafeArrayGetDim
(
vbarray
->
safearray
))
return
JS_E_SUBSCRIPT_OUT_OF_RANGE
;
return
JS_E_SUBSCRIPT_OUT_OF_RANGE
;
indexes
=
heap_
alloc
(
sizeof
(
indexes
[
0
])
*
argc
);
indexes
=
m
alloc
(
sizeof
(
indexes
[
0
])
*
argc
);
if
(
!
indexes
)
if
(
!
indexes
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
hres
=
to_long
(
ctx
,
argv
[
i
],
indexes
+
i
);
hres
=
to_long
(
ctx
,
argv
[
i
],
indexes
+
i
);
if
(
FAILED
(
hres
))
{
if
(
FAILED
(
hres
))
{
heap_
free
(
indexes
);
free
(
indexes
);
return
hres
;
return
hres
;
}
}
}
}
hres
=
SafeArrayGetElement
(
vbarray
->
safearray
,
indexes
,
(
void
*
)
&
out
);
hres
=
SafeArrayGetElement
(
vbarray
->
safearray
,
indexes
,
(
void
*
)
&
out
);
heap_
free
(
indexes
);
free
(
indexes
);
if
(
hres
==
DISP_E_BADINDEX
)
if
(
hres
==
DISP_E_BADINDEX
)
return
JS_E_SUBSCRIPT_OUT_OF_RANGE
;
return
JS_E_SUBSCRIPT_OUT_OF_RANGE
;
else
if
(
FAILED
(
hres
))
else
if
(
FAILED
(
hres
))
...
@@ -235,7 +235,7 @@ static void VBArray_destructor(jsdisp_t *dispex)
...
@@ -235,7 +235,7 @@ static void VBArray_destructor(jsdisp_t *dispex)
VBArrayInstance
*
vbarray
=
vbarray_from_jsdisp
(
dispex
);
VBArrayInstance
*
vbarray
=
vbarray_from_jsdisp
(
dispex
);
SafeArrayDestroy
(
vbarray
->
safearray
);
SafeArrayDestroy
(
vbarray
->
safearray
);
heap_
free
(
vbarray
);
free
(
vbarray
);
}
}
static
const
builtin_prop_t
VBArray_props
[]
=
{
static
const
builtin_prop_t
VBArray_props
[]
=
{
...
@@ -260,7 +260,7 @@ static HRESULT alloc_vbarray(script_ctx_t *ctx, jsdisp_t *object_prototype, VBAr
...
@@ -260,7 +260,7 @@ static HRESULT alloc_vbarray(script_ctx_t *ctx, jsdisp_t *object_prototype, VBAr
VBArrayInstance
*
vbarray
;
VBArrayInstance
*
vbarray
;
HRESULT
hres
;
HRESULT
hres
;
vbarray
=
heap_alloc_zero
(
sizeof
(
VBArrayInstance
));
vbarray
=
calloc
(
1
,
sizeof
(
VBArrayInstance
));
if
(
!
vbarray
)
if
(
!
vbarray
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -270,7 +270,7 @@ static HRESULT alloc_vbarray(script_ctx_t *ctx, jsdisp_t *object_prototype, VBAr
...
@@ -270,7 +270,7 @@ static HRESULT alloc_vbarray(script_ctx_t *ctx, jsdisp_t *object_prototype, VBAr
hres
=
init_dispex_from_constr
(
&
vbarray
->
dispex
,
ctx
,
&
VBArray_info
,
ctx
->
vbarray_constr
);
hres
=
init_dispex_from_constr
(
&
vbarray
->
dispex
,
ctx
,
&
VBArray_info
,
ctx
->
vbarray_constr
);
if
(
FAILED
(
hres
))
{
if
(
FAILED
(
hres
))
{
heap_
free
(
vbarray
);
free
(
vbarray
);
return
hres
;
return
hres
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment