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
796f2822
Commit
796f2822
authored
Nov 10, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Nov 15, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Use CRT allocation functions.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
ffac93db
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
143 additions
and
161 deletions
+143
-161
compile.c
dlls/vbscript/compile.c
+19
-19
global.c
dlls/vbscript/global.c
+9
-9
interp.c
dlls/vbscript/interp.c
+17
-17
lex.c
dlls/vbscript/lex.c
+2
-2
regexp.c
dlls/vbscript/regexp.c
+15
-15
regexp.h
dlls/vbscript/regexp.h
+1
-1
utils.c
dlls/vbscript/utils.c
+3
-3
vbdisp.c
dlls/vbscript/vbdisp.c
+23
-23
vbregexp.c
dlls/vbscript/vbregexp.c
+27
-27
vbscript.c
dlls/vbscript/vbscript.c
+19
-20
vbscript.h
dlls/vbscript/vbscript.h
+0
-17
vbscript_main.c
dlls/vbscript/vbscript_main.c
+8
-8
No files found.
dlls/vbscript/compile.c
View file @
796f2822
...
...
@@ -155,7 +155,7 @@ static unsigned push_instr(compile_ctx_t *ctx, vbsop_t op)
if
(
ctx
->
instr_size
==
ctx
->
instr_cnt
)
{
instr_t
*
new_instr
;
new_instr
=
heap_
realloc
(
ctx
->
code
->
instrs
,
ctx
->
instr_size
*
2
*
sizeof
(
instr_t
));
new_instr
=
realloc
(
ctx
->
code
->
instrs
,
ctx
->
instr_size
*
2
*
sizeof
(
instr_t
));
if
(
!
new_instr
)
return
0
;
...
...
@@ -260,14 +260,14 @@ static HRESULT push_instr_date(compile_ctx_t *ctx, vbsop_t op, DATE arg)
static
BSTR
alloc_bstr_arg
(
compile_ctx_t
*
ctx
,
const
WCHAR
*
str
)
{
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
)
return
NULL
;
ctx
->
code
->
bstr_pool_size
=
8
;
}
else
if
(
ctx
->
code
->
bstr_pool_size
==
ctx
->
code
->
bstr_cnt
)
{
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
)
return
NULL
;
...
...
@@ -340,14 +340,14 @@ static HRESULT push_instr_uint_bstr(compile_ctx_t *ctx, vbsop_t op, unsigned arg
static
unsigned
alloc_label
(
compile_ctx_t
*
ctx
)
{
if
(
!
ctx
->
labels_size
)
{
ctx
->
labels
=
heap_
alloc
(
8
*
sizeof
(
*
ctx
->
labels
));
ctx
->
labels
=
m
alloc
(
8
*
sizeof
(
*
ctx
->
labels
));
if
(
!
ctx
->
labels
)
return
0
;
ctx
->
labels_size
=
8
;
}
else
if
(
ctx
->
labels_size
==
ctx
->
labels_cnt
)
{
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
)
return
0
;
...
...
@@ -963,7 +963,7 @@ static HRESULT compile_select_statement(compile_ctx_t *ctx, select_statement_t *
case_cnt
++
;
if
(
case_cnt
)
{
case_labels
=
heap_
alloc
(
case_cnt
*
sizeof
(
*
case_labels
));
case_labels
=
m
alloc
(
case_cnt
*
sizeof
(
*
case_labels
));
if
(
!
case_labels
)
return
E_OUTOFMEMORY
;
}
...
...
@@ -995,19 +995,19 @@ static HRESULT compile_select_statement(compile_ctx_t *ctx, select_statement_t *
}
if
(
FAILED
(
hres
))
{
heap_
free
(
case_labels
);
free
(
case_labels
);
return
hres
;
}
hres
=
push_instr_uint
(
ctx
,
OP_pop
,
1
);
if
(
FAILED
(
hres
))
{
heap_
free
(
case_labels
);
free
(
case_labels
);
return
hres
;
}
hres
=
push_instr_addr
(
ctx
,
OP_jmp
,
case_iter
?
case_labels
[
i
]
:
end_label
);
if
(
FAILED
(
hres
))
{
heap_
free
(
case_labels
);
free
(
case_labels
);
return
hres
;
}
...
...
@@ -1025,7 +1025,7 @@ static HRESULT compile_select_statement(compile_ctx_t *ctx, select_statement_t *
break
;
}
heap_
free
(
case_labels
);
free
(
case_labels
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -1923,10 +1923,10 @@ void release_vbscode(vbscode_t *code)
release_named_item
(
code
->
named_item
);
heap_pool_free
(
&
code
->
heap
);
heap_
free
(
code
->
bstr_pool
);
heap_
free
(
code
->
source
);
heap_
free
(
code
->
instrs
);
heap_
free
(
code
);
free
(
code
->
bstr_pool
);
free
(
code
->
source
);
free
(
code
->
instrs
);
free
(
code
);
}
static
vbscode_t
*
alloc_vbscode
(
compile_ctx_t
*
ctx
,
const
WCHAR
*
source
,
DWORD_PTR
cookie
,
unsigned
start_line
)
...
...
@@ -1938,13 +1938,13 @@ static vbscode_t *alloc_vbscode(compile_ctx_t *ctx, const WCHAR *source, DWORD_P
if
(
len
>
INT32_MAX
)
return
NULL
;
ret
=
heap_alloc_zero
(
sizeof
(
*
ret
));
ret
=
calloc
(
1
,
sizeof
(
*
ret
));
if
(
!
ret
)
return
NULL
;
ret
->
source
=
heap_
alloc
((
len
+
1
)
*
sizeof
(
WCHAR
));
ret
->
source
=
m
alloc
((
len
+
1
)
*
sizeof
(
WCHAR
));
if
(
!
ret
->
source
)
{
heap_
free
(
ret
);
free
(
ret
);
return
NULL
;
}
if
(
len
)
...
...
@@ -1954,7 +1954,7 @@ static vbscode_t *alloc_vbscode(compile_ctx_t *ctx, const WCHAR *source, DWORD_P
ret
->
cookie
=
cookie
;
ret
->
start_line
=
start_line
;
ret
->
instrs
=
heap_
alloc
(
32
*
sizeof
(
instr_t
));
ret
->
instrs
=
m
alloc
(
32
*
sizeof
(
instr_t
));
if
(
!
ret
->
instrs
)
{
release_vbscode
(
ret
);
return
NULL
;
...
...
@@ -1975,7 +1975,7 @@ static vbscode_t *alloc_vbscode(compile_ctx_t *ctx, const WCHAR *source, DWORD_P
static
void
release_compiler
(
compile_ctx_t
*
ctx
)
{
parser_release
(
&
ctx
->
parser
);
heap_
free
(
ctx
->
labels
);
free
(
ctx
->
labels
);
if
(
ctx
->
code
)
release_vbscode
(
ctx
->
code
);
}
...
...
dlls/vbscript/global.c
View file @
796f2822
...
...
@@ -98,7 +98,7 @@ static ULONG WINAPI Builtin_Release(IDispatch *iface)
if
(
!
ref
)
{
assert
(
!
This
->
ctx
);
heap_
free
(
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -249,7 +249,7 @@ static HRESULT WINAPI Builtin_Invoke(IDispatch *iface, DISPID id, REFIID riid, L
if
(
argn
<=
ARRAY_SIZE
(
args_buf
))
{
args
=
args_buf
;
}
else
{
args
=
heap_
alloc
(
argn
*
sizeof
(
*
args
));
args
=
m
alloc
(
argn
*
sizeof
(
*
args
));
if
(
!
args
)
return
E_OUTOFMEMORY
;
}
...
...
@@ -263,7 +263,7 @@ static HRESULT WINAPI Builtin_Invoke(IDispatch *iface, DISPID id, REFIID riid, L
hres
=
prop
->
proc
(
This
,
args
,
dp
->
cArgs
,
res
);
if
(
args
!=
args_buf
)
heap_
free
(
args
);
free
(
args
);
return
hres
;
}
...
...
@@ -281,7 +281,7 @@ static HRESULT create_builtin_dispatch(script_ctx_t *ctx, const builtin_prop_t *
{
BuiltinDisp
*
disp
;
if
(
!
(
disp
=
heap_
alloc
(
sizeof
(
*
disp
))))
if
(
!
(
disp
=
m
alloc
(
sizeof
(
*
disp
))))
return
E_OUTOFMEMORY
;
disp
->
IDispatch_iface
.
lpVtbl
=
&
BuiltinDispVtbl
;
...
...
@@ -611,7 +611,7 @@ static HRESULT show_msgbox(script_ctx_t *ctx, BSTR prompt, unsigned type, BSTR o
if
(
orig_title
&&
*
orig_title
)
{
WCHAR
*
ptr
;
title
=
title_buf
=
heap_
alloc
(
sizeof
(
L"VBScript"
)
+
(
lstrlenW
(
orig_title
)
+
2
)
*
sizeof
(
WCHAR
));
title
=
title_buf
=
m
alloc
(
sizeof
(
L"VBScript"
)
+
(
lstrlenW
(
orig_title
)
+
2
)
*
sizeof
(
WCHAR
));
if
(
!
title
)
return
E_OUTOFMEMORY
;
...
...
@@ -637,7 +637,7 @@ static HRESULT show_msgbox(script_ctx_t *ctx, BSTR prompt, unsigned type, BSTR o
}
}
heap_
free
(
title_buf
);
free
(
title_buf
);
IActiveScriptSiteWindow_Release
(
acts_window
);
if
(
FAILED
(
hres
))
{
FIXME
(
"failed: %08lx
\n
"
,
hres
);
...
...
@@ -2630,7 +2630,7 @@ static HRESULT Global_Split(BuiltinDisp *This, VARIANT *args, unsigned args_cnt,
len
=
SysStringLen
(
string
);
count
=
0
;
indices
=
heap_
alloc
(
indices_max
*
sizeof
(
int
));
indices
=
m
alloc
(
indices_max
*
sizeof
(
int
));
if
(
!
indices
)
{
hres
=
E_OUTOFMEMORY
;
goto
error
;
...
...
@@ -2651,7 +2651,7 @@ static HRESULT Global_Split(BuiltinDisp *This, VARIANT *args, unsigned args_cnt,
if
(
count
==
indices_max
)
{
indices_max
*=
2
;
indices
=
heap_
realloc
(
indices
,
indices_max
*
sizeof
(
int
));
indices
=
realloc
(
indices
,
indices_max
*
sizeof
(
int
));
if
(
!
indices
)
{
hres
=
E_OUTOFMEMORY
;
goto
error
;
...
...
@@ -2703,7 +2703,7 @@ error:
SafeArrayDestroy
(
sa
);
}
heap_
free
(
indices
);
free
(
indices
);
if
(
V_VT
(
args
)
!=
VT_BSTR
)
SysFreeString
(
string
);
if
(
args_cnt
>
1
&&
V_VT
(
args
+
1
)
!=
VT_BSTR
)
...
...
dlls/vbscript/interp.c
View file @
796f2822
...
...
@@ -267,9 +267,9 @@ static HRESULT add_dynamic_var(exec_ctx_t *ctx, const WCHAR *name,
if
(
cnt
>
script_obj
->
global_vars_size
)
{
dynamic_var_t
**
new_vars
;
if
(
script_obj
->
global_vars
)
new_vars
=
heap_
realloc
(
script_obj
->
global_vars
,
cnt
*
2
*
sizeof
(
*
new_vars
));
new_vars
=
realloc
(
script_obj
->
global_vars
,
cnt
*
2
*
sizeof
(
*
new_vars
));
else
new_vars
=
heap_
alloc
(
cnt
*
2
*
sizeof
(
*
new_vars
));
new_vars
=
m
alloc
(
cnt
*
2
*
sizeof
(
*
new_vars
));
if
(
!
new_vars
)
return
E_OUTOFMEMORY
;
script_obj
->
global_vars
=
new_vars
;
...
...
@@ -318,7 +318,7 @@ static HRESULT stack_push(exec_ctx_t *ctx, VARIANT *v)
if
(
ctx
->
stack_size
==
ctx
->
top
)
{
VARIANT
*
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
)
{
VariantClear
(
v
);
return
E_OUTOFMEMORY
;
...
...
@@ -556,7 +556,7 @@ static HRESULT array_access(exec_ctx_t *ctx, SAFEARRAY *array, DISPPARAMS *dp, V
return
E_FAIL
;
}
indices
=
heap_
alloc
(
sizeof
(
*
indices
)
*
argc
);
indices
=
m
alloc
(
sizeof
(
*
indices
)
*
argc
);
if
(
!
indices
)
{
SafeArrayUnlock
(
array
);
return
E_OUTOFMEMORY
;
...
...
@@ -565,7 +565,7 @@ static HRESULT array_access(exec_ctx_t *ctx, SAFEARRAY *array, DISPPARAMS *dp, V
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
hres
=
to_int
(
get_arg
(
dp
,
i
),
(
int
*
)(
indices
+
i
));
if
(
FAILED
(
hres
))
{
heap_
free
(
indices
);
free
(
indices
);
SafeArrayUnlock
(
array
);
return
hres
;
}
...
...
@@ -573,7 +573,7 @@ static HRESULT array_access(exec_ctx_t *ctx, SAFEARRAY *array, DISPPARAMS *dp, V
hres
=
SafeArrayPtrOfIndex
(
array
,
indices
,
(
void
**
)
ret
);
SafeArrayUnlock
(
array
);
heap_
free
(
indices
);
free
(
indices
);
return
hres
;
}
...
...
@@ -1216,7 +1216,7 @@ static HRESULT interp_dim(exec_ctx_t *ctx)
ref_t
ref
;
if
(
!
ctx
->
arrays
)
{
ctx
->
arrays
=
heap_alloc_zero
(
ctx
->
func
->
array_cnt
*
sizeof
(
SAFEARRAY
*
));
ctx
->
arrays
=
calloc
(
ctx
->
func
->
array_cnt
,
sizeof
(
SAFEARRAY
*
));
if
(
!
ctx
->
arrays
)
return
E_OUTOFMEMORY
;
}
...
...
@@ -1260,13 +1260,13 @@ static HRESULT array_bounds_from_stack(exec_ctx_t *ctx, unsigned dim_cnt, SAFEAR
int
dim
;
HRESULT
hres
;
if
(
!
(
bounds
=
heap_
alloc
(
dim_cnt
*
sizeof
(
*
bounds
))))
if
(
!
(
bounds
=
m
alloc
(
dim_cnt
*
sizeof
(
*
bounds
))))
return
E_OUTOFMEMORY
;
for
(
i
=
0
;
i
<
dim_cnt
;
i
++
)
{
hres
=
to_int
(
stack_top
(
ctx
,
dim_cnt
-
i
-
1
),
&
dim
);
if
(
FAILED
(
hres
))
{
heap_
free
(
bounds
);
free
(
bounds
);
return
hres
;
}
...
...
@@ -1306,7 +1306,7 @@ static HRESULT interp_redim(exec_ctx_t *ctx)
return
hres
;
array
=
SafeArrayCreate
(
VT_VARIANT
,
dim_cnt
,
bounds
);
heap_
free
(
bounds
);
free
(
bounds
);
if
(
!
array
)
return
E_OUTOFMEMORY
;
...
...
@@ -2398,13 +2398,13 @@ static void release_exec(exec_ctx_t *ctx)
if
(
ctx
->
arrays
[
i
])
SafeArrayDestroy
(
ctx
->
arrays
[
i
]);
}
heap_
free
(
ctx
->
arrays
);
free
(
ctx
->
arrays
);
}
heap_pool_free
(
&
ctx
->
heap
);
heap_
free
(
ctx
->
args
);
heap_
free
(
ctx
->
vars
);
heap_
free
(
ctx
->
stack
);
free
(
ctx
->
args
);
free
(
ctx
->
vars
);
free
(
ctx
->
stack
);
}
HRESULT
exec_script
(
script_ctx_t
*
ctx
,
BOOL
extern_caller
,
function_t
*
func
,
vbdisp_t
*
vbthis
,
DISPPARAMS
*
dp
,
VARIANT
*
res
)
...
...
@@ -2427,7 +2427,7 @@ HRESULT exec_script(script_ctx_t *ctx, BOOL extern_caller, function_t *func, vbd
VARIANT
*
v
;
unsigned
i
;
exec
.
args
=
heap_alloc_zero
(
func
->
arg_cnt
*
sizeof
(
VARIANT
));
exec
.
args
=
calloc
(
func
->
arg_cnt
,
sizeof
(
VARIANT
));
if
(
!
exec
.
args
)
{
release_exec
(
&
exec
);
return
E_OUTOFMEMORY
;
...
...
@@ -2454,7 +2454,7 @@ HRESULT exec_script(script_ctx_t *ctx, BOOL extern_caller, function_t *func, vbd
}
if
(
func
->
var_cnt
)
{
exec
.
vars
=
heap_alloc_zero
(
func
->
var_cnt
*
sizeof
(
VARIANT
));
exec
.
vars
=
calloc
(
func
->
var_cnt
,
sizeof
(
VARIANT
));
if
(
!
exec
.
vars
)
{
release_exec
(
&
exec
);
return
E_OUTOFMEMORY
;
...
...
@@ -2465,7 +2465,7 @@ HRESULT exec_script(script_ctx_t *ctx, BOOL extern_caller, function_t *func, vbd
exec
.
stack_size
=
16
;
exec
.
top
=
0
;
exec
.
stack
=
heap_
alloc
(
exec
.
stack_size
*
sizeof
(
VARIANT
));
exec
.
stack
=
m
alloc
(
exec
.
stack_size
*
sizeof
(
VARIANT
));
if
(
!
exec
.
stack
)
{
release_exec
(
&
exec
);
return
E_OUTOFMEMORY
;
...
...
dlls/vbscript/lex.c
View file @
796f2822
...
...
@@ -229,14 +229,14 @@ static int parse_date_literal(parser_ctx_t *ctx, DATE *ret)
len
+=
ctx
->
ptr
-
ptr
;
rptr
=
heap_
alloc
((
len
+
1
)
*
sizeof
(
WCHAR
));
rptr
=
m
alloc
((
len
+
1
)
*
sizeof
(
WCHAR
));
if
(
!
rptr
)
return
0
;
memcpy
(
rptr
,
ptr
,
len
*
sizeof
(
WCHAR
));
rptr
[
len
]
=
0
;
res
=
VarDateFromStr
(
rptr
,
ctx
->
lcid
,
0
,
ret
);
heap_
free
(
rptr
);
free
(
rptr
);
if
(
FAILED
(
res
))
{
FIXME
(
"Invalid date literal
\n
"
);
return
0
;
...
...
dlls/vbscript/regexp.c
View file @
796f2822
...
...
@@ -482,7 +482,7 @@ EmitREBytecode(CompilerState *state, regexp_t *re, size_t treeDepth,
if
(
treeDepth
==
0
)
{
emitStateStack
=
NULL
;
}
else
{
emitStateStack
=
heap_
alloc
(
sizeof
(
EmitStateStackEntry
)
*
treeDepth
);
emitStateStack
=
m
alloc
(
sizeof
(
EmitStateStackEntry
)
*
treeDepth
);
if
(
!
emitStateStack
)
return
NULL
;
}
...
...
@@ -788,7 +788,7 @@ EmitREBytecode(CompilerState *state, regexp_t *re, size_t treeDepth,
}
cleanup:
heap_
free
(
emitStateStack
);
free
(
emitStateStack
);
return
pc
;
jump_too_big:
...
...
@@ -1667,11 +1667,11 @@ ParseRegExp(CompilerState *state)
return
(
state
->
result
!=
NULL
);
}
operatorStack
=
heap_
alloc
(
sizeof
(
REOpData
)
*
operatorStackSize
);
operatorStack
=
m
alloc
(
sizeof
(
REOpData
)
*
operatorStackSize
);
if
(
!
operatorStack
)
return
FALSE
;
operandStack
=
heap_
alloc
(
sizeof
(
RENode
*
)
*
operandStackSize
);
operandStack
=
m
alloc
(
sizeof
(
RENode
*
)
*
operandStackSize
);
if
(
!
operandStack
)
goto
out
;
...
...
@@ -1762,7 +1762,7 @@ pushOperand:
if
(
operandSP
==
operandStackSize
)
{
RENode
**
tmp
;
operandStackSize
+=
operandStackSize
;
tmp
=
heap_
realloc
(
operandStack
,
sizeof
(
RENode
*
)
*
operandStackSize
);
tmp
=
realloc
(
operandStack
,
sizeof
(
RENode
*
)
*
operandStackSize
);
if
(
!
tmp
)
goto
out
;
operandStack
=
tmp
;
...
...
@@ -1895,7 +1895,7 @@ pushOperator:
if
(
operatorSP
==
operatorStackSize
)
{
REOpData
*
tmp
;
operatorStackSize
+=
operatorStackSize
;
tmp
=
heap_
realloc
(
operatorStack
,
sizeof
(
REOpData
)
*
operatorStackSize
);
tmp
=
realloc
(
operatorStack
,
sizeof
(
REOpData
)
*
operatorStackSize
);
if
(
!
tmp
)
goto
out
;
operatorStack
=
tmp
;
...
...
@@ -1907,8 +1907,8 @@ pushOperator:
}
}
out:
heap_
free
(
operatorStack
);
heap_
free
(
operandStack
);
free
(
operatorStack
);
free
(
operandStack
);
return
result
;
}
...
...
@@ -2111,7 +2111,7 @@ ProcessCharSet(REGlobalData *gData, RECharSet *charSet)
assert
(
src
[
-
1
]
==
'['
&&
end
[
0
]
==
']'
);
byteLength
=
(
charSet
->
length
>>
3
)
+
1
;
charSet
->
u
.
bits
=
heap_
alloc
(
byteLength
);
charSet
->
u
.
bits
=
m
alloc
(
byteLength
);
if
(
!
charSet
->
u
.
bits
)
{
JS_ReportOutOfMemory
(
gData
->
cx
);
gData
->
ok
=
FALSE
;
...
...
@@ -3184,12 +3184,12 @@ void regexp_destroy(regexp_t *re)
UINT
i
;
for
(
i
=
0
;
i
<
re
->
classCount
;
i
++
)
{
if
(
re
->
classList
[
i
].
converted
)
heap_
free
(
re
->
classList
[
i
].
u
.
bits
);
free
(
re
->
classList
[
i
].
u
.
bits
);
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
,
...
...
@@ -3238,14 +3238,14 @@ regexp_t* regexp_new(void *cx, heap_pool_t *pool, const WCHAR *str,
goto
out
;
}
resize
=
offsetof
(
regexp_t
,
program
)
+
state
.
progLength
+
1
;
re
=
heap_
alloc
(
resize
);
re
=
m
alloc
(
resize
);
if
(
!
re
)
goto
out
;
assert
(
state
.
classBitmapsMem
<=
CLASS_BITMAPS_MEM_LIMIT
);
re
->
classCount
=
state
.
classCount
;
if
(
re
->
classCount
)
{
re
->
classList
=
heap_
alloc
(
re
->
classCount
*
sizeof
(
RECharSet
));
re
->
classList
=
m
alloc
(
re
->
classCount
*
sizeof
(
RECharSet
));
if
(
!
re
->
classList
)
{
regexp_destroy
(
re
);
re
=
NULL
;
...
...
@@ -3272,7 +3272,7 @@ regexp_t* regexp_new(void *cx, heap_pool_t *pool, const WCHAR *str,
regexp_t
*
tmp
;
assert
((
size_t
)(
endPC
-
re
->
program
)
<
state
.
progLength
+
1
);
resize
=
offsetof
(
regexp_t
,
program
)
+
(
endPC
-
re
->
program
);
tmp
=
heap_
realloc
(
re
,
resize
);
tmp
=
realloc
(
re
,
resize
);
if
(
tmp
)
re
=
tmp
;
}
...
...
dlls/vbscript/regexp.h
View file @
796f2822
...
...
@@ -73,7 +73,7 @@ static inline match_state_t* alloc_match_state(regexp_t *regexp,
size_t
size
=
offsetof
(
match_state_t
,
parens
)
+
regexp
->
parenCount
*
sizeof
(
RECapture
);
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
)
return
NULL
;
...
...
dlls/vbscript/utils.c
View file @
796f2822
...
...
@@ -77,7 +77,7 @@ static ULONG WINAPI safearray_iter_IEnumVARIANT_Release(IEnumVARIANT *iface)
if
(
!
ref
)
{
if
(
This
->
sa
)
SafeArrayUnlock
(
This
->
sa
);
heap_
free
(
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -170,14 +170,14 @@ HRESULT create_safearray_iter(SAFEARRAY *sa, IEnumVARIANT **ev)
return
E_NOTIMPL
;
}
iter
=
heap_
alloc
(
sizeof
(
*
iter
));
iter
=
m
alloc
(
sizeof
(
*
iter
));
if
(
!
iter
)
return
E_OUTOFMEMORY
;
if
(
sa
)
{
hres
=
SafeArrayLock
(
sa
);
if
(
FAILED
(
hres
))
{
heap_
free
(
iter
);
free
(
iter
);
return
hres
;
}
}
...
...
dlls/vbscript/vbdisp.c
View file @
796f2822
...
...
@@ -203,7 +203,7 @@ static HRESULT invoke_vbdisp(vbdisp_t *This, DISPID id, DWORD flags, BOOL extern
dp
.
cArgs
=
arg_cnt
(
params
)
+
1
;
if
(
dp
.
cArgs
>
ARRAY_SIZE
(
buf
))
{
dp
.
rgvarg
=
heap_
alloc
(
dp
.
cArgs
*
sizeof
(
VARIANT
));
dp
.
rgvarg
=
m
alloc
(
dp
.
cArgs
*
sizeof
(
VARIANT
));
if
(
!
dp
.
rgvarg
)
return
E_OUTOFMEMORY
;
}
else
{
...
...
@@ -213,7 +213,7 @@ static HRESULT invoke_vbdisp(vbdisp_t *This, DISPID id, DWORD flags, BOOL extern
hres
=
get_propput_arg
(
This
->
desc
->
ctx
,
params
,
flags
,
dp
.
rgvarg
,
&
needs_release
);
if
(
FAILED
(
hres
))
{
if
(
dp
.
rgvarg
!=
buf
)
heap_
free
(
dp
.
rgvarg
);
free
(
dp
.
rgvarg
);
return
hres
;
}
...
...
@@ -221,7 +221,7 @@ static HRESULT invoke_vbdisp(vbdisp_t *This, DISPID id, DWORD flags, BOOL extern
if
(
!
func
)
{
FIXME
(
"no letter/setter
\n
"
);
if
(
dp
.
rgvarg
!=
buf
)
heap_
free
(
dp
.
rgvarg
);
free
(
dp
.
rgvarg
);
return
DISP_E_MEMBERNOTFOUND
;
}
...
...
@@ -233,7 +233,7 @@ static HRESULT invoke_vbdisp(vbdisp_t *This, DISPID id, DWORD flags, BOOL extern
if
(
needs_release
)
VariantClear
(
dp
.
rgvarg
);
if
(
dp
.
rgvarg
!=
buf
)
heap_
free
(
dp
.
rgvarg
);
free
(
dp
.
rgvarg
);
return
hres
;
}
default:
...
...
@@ -332,8 +332,8 @@ static ULONG WINAPI DispatchEx_Release(IDispatchEx *iface)
if
(
!
ref
&&
run_terminator
(
This
))
{
clean_props
(
This
);
list_remove
(
&
This
->
entry
);
heap_
free
(
This
->
arrays
);
heap_
free
(
This
);
free
(
This
->
arrays
);
free
(
This
);
}
return
ref
;
...
...
@@ -488,7 +488,7 @@ HRESULT create_vbdisp(const class_desc_t *desc, vbdisp_t **ret)
vbdisp_t
*
vbdisp
;
HRESULT
hres
=
S_OK
;
vbdisp
=
heap_alloc_zero
(
FIELD_OFFSET
(
vbdisp_t
,
props
[
desc
->
prop_cnt
]
));
vbdisp
=
calloc
(
1
,
FIELD_OFFSET
(
vbdisp_t
,
props
[
desc
->
prop_cnt
]
));
if
(
!
vbdisp
)
return
E_OUTOFMEMORY
;
...
...
@@ -499,7 +499,7 @@ HRESULT create_vbdisp(const class_desc_t *desc, vbdisp_t **ret)
list_add_tail
(
&
desc
->
ctx
->
objects
,
&
vbdisp
->
entry
);
if
(
desc
->
array_cnt
)
{
vbdisp
->
arrays
=
heap_alloc_zero
(
desc
->
array_cnt
*
sizeof
(
*
vbdisp
->
arrays
));
vbdisp
->
arrays
=
calloc
(
desc
->
array_cnt
,
sizeof
(
*
vbdisp
->
arrays
));
if
(
vbdisp
->
arrays
)
{
unsigned
i
,
j
;
...
...
@@ -633,8 +633,8 @@ static ULONG WINAPI ScriptTypeInfo_Release(ITypeInfo *iface)
release_vbscode
(
This
->
funcs
[
i
].
func
->
code_ctx
);
IDispatchEx_Release
(
&
This
->
disp
->
IDispatchEx_iface
);
heap_
free
(
This
->
funcs
);
heap_
free
(
This
);
free
(
This
->
funcs
);
free
(
This
);
}
return
ref
;
}
...
...
@@ -648,7 +648,7 @@ static HRESULT WINAPI ScriptTypeInfo_GetTypeAttr(ITypeInfo *iface, TYPEATTR **pp
if
(
!
ppTypeAttr
)
return
E_INVALIDARG
;
attr
=
heap_alloc_zero
(
sizeof
(
*
attr
));
attr
=
calloc
(
1
,
sizeof
(
*
attr
));
if
(
!
attr
)
return
E_OUTOFMEMORY
;
attr
->
guid
=
GUID_VBScriptTypeInfo
;
...
...
@@ -697,7 +697,7 @@ static HRESULT WINAPI ScriptTypeInfo_GetFuncDesc(ITypeInfo *iface, UINT index, F
func
=
This
->
funcs
[
index
].
func
;
/* Store the parameter array after the FUNCDESC structure */
desc
=
heap_alloc_zero
(
sizeof
(
*
desc
)
+
sizeof
(
ELEMDESC
)
*
func
->
arg_cnt
);
desc
=
calloc
(
1
,
sizeof
(
*
desc
)
+
sizeof
(
ELEMDESC
)
*
func
->
arg_cnt
);
if
(
!
desc
)
return
E_OUTOFMEMORY
;
desc
->
memid
=
This
->
funcs
[
index
].
memid
;
...
...
@@ -725,7 +725,7 @@ static HRESULT WINAPI ScriptTypeInfo_GetVarDesc(ITypeInfo *iface, UINT index, VA
if
(
!
ppVarDesc
)
return
E_INVALIDARG
;
if
(
index
>=
This
->
num_vars
)
return
TYPE_E_ELEMENTNOTFOUND
;
desc
=
heap_alloc_zero
(
sizeof
(
*
desc
));
desc
=
calloc
(
1
,
sizeof
(
*
desc
));
if
(
!
desc
)
return
E_OUTOFMEMORY
;
desc
->
memid
=
index
+
1
;
...
...
@@ -1061,7 +1061,7 @@ static void WINAPI ScriptTypeInfo_ReleaseTypeAttr(ITypeInfo *iface, TYPEATTR *pT
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
pTypeAttr
);
heap_
free
(
pTypeAttr
);
free
(
pTypeAttr
);
}
static
void
WINAPI
ScriptTypeInfo_ReleaseFuncDesc
(
ITypeInfo
*
iface
,
FUNCDESC
*
pFuncDesc
)
...
...
@@ -1070,7 +1070,7 @@ static void WINAPI ScriptTypeInfo_ReleaseFuncDesc(ITypeInfo *iface, FUNCDESC *pF
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
pFuncDesc
);
heap_
free
(
pFuncDesc
);
free
(
pFuncDesc
);
}
static
void
WINAPI
ScriptTypeInfo_ReleaseVarDesc
(
ITypeInfo
*
iface
,
VARDESC
*
pVarDesc
)
...
...
@@ -1079,7 +1079,7 @@ static void WINAPI ScriptTypeInfo_ReleaseVarDesc(ITypeInfo *iface, VARDESC *pVar
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
pVarDesc
);
heap_
free
(
pVarDesc
);
free
(
pVarDesc
);
}
static
const
ITypeInfoVtbl
ScriptTypeInfoVtbl
=
{
...
...
@@ -1267,9 +1267,9 @@ static ULONG WINAPI ScriptDisp_Release(IDispatchEx *iface)
release_dynamic_var
(
This
->
global_vars
[
i
]);
heap_pool_free
(
&
This
->
heap
);
heap_
free
(
This
->
global_vars
);
heap_
free
(
This
->
global_funcs
);
heap_
free
(
This
);
free
(
This
->
global_vars
);
free
(
This
->
global_funcs
);
free
(
This
);
}
return
ref
;
...
...
@@ -1297,7 +1297,7 @@ static HRESULT WINAPI ScriptDisp_GetTypeInfo(IDispatchEx *iface, UINT iTInfo, LC
if
(
iTInfo
)
return
DISP_E_BADINDEX
;
if
(
!
(
type_info
=
heap_alloc
(
sizeof
(
*
type_info
))))
if
(
!
(
type_info
=
calloc
(
1
,
sizeof
(
*
type_info
))))
return
E_OUTOFMEMORY
;
for
(
i
=
0
;
i
<
This
->
global_funcs_cnt
;
i
++
)
...
...
@@ -1311,10 +1311,10 @@ static HRESULT WINAPI ScriptDisp_GetTypeInfo(IDispatchEx *iface, UINT iTInfo, LC
type_info
->
num_vars
=
This
->
global_vars_cnt
;
type_info
->
disp
=
This
;
type_info
->
funcs
=
heap_alloc
(
sizeof
(
*
type_info
->
funcs
)
*
num_funcs
);
type_info
->
funcs
=
calloc
(
num_funcs
,
sizeof
(
*
type_info
->
funcs
)
);
if
(
!
type_info
->
funcs
)
{
heap_
free
(
type_info
);
free
(
type_info
);
return
E_OUTOFMEMORY
;
}
...
...
@@ -1508,7 +1508,7 @@ HRESULT create_script_disp(script_ctx_t *ctx, ScriptDisp **ret)
{
ScriptDisp
*
script_disp
;
script_disp
=
heap_alloc_zero
(
sizeof
(
*
script_disp
));
script_disp
=
calloc
(
1
,
sizeof
(
*
script_disp
));
if
(
!
script_disp
)
return
E_OUTOFMEMORY
;
...
...
dlls/vbscript/vbregexp.c
View file @
796f2822
...
...
@@ -183,9 +183,9 @@ static ULONG WINAPI SubMatches_Release(ISubMatches *iface)
TRACE
(
"(%p) ref=%ld
\n
"
,
This
,
ref
);
if
(
!
ref
)
{
heap_
free
(
This
->
match
);
heap_
free
(
This
->
result
);
heap_
free
(
This
);
free
(
This
->
match
);
free
(
This
->
result
);
free
(
This
);
}
return
ref
;
...
...
@@ -307,7 +307,7 @@ static HRESULT create_sub_matches(DWORD pos, match_state_t *result, SubMatches *
if
(
FAILED
(
hres
))
return
hres
;
ret
=
heap_alloc_zero
(
sizeof
(
*
ret
));
ret
=
calloc
(
1
,
sizeof
(
*
ret
));
if
(
!
ret
)
return
E_OUTOFMEMORY
;
...
...
@@ -315,9 +315,9 @@ static HRESULT create_sub_matches(DWORD pos, match_state_t *result, SubMatches *
ret
->
result
=
result
;
if
(
result
)
{
ret
->
match
=
heap_
alloc
((
result
->
match_len
+
1
)
*
sizeof
(
WCHAR
));
ret
->
match
=
m
alloc
((
result
->
match_len
+
1
)
*
sizeof
(
WCHAR
));
if
(
!
ret
->
match
)
{
heap_
free
(
ret
);
free
(
ret
);
return
E_OUTOFMEMORY
;
}
memcpy
(
ret
->
match
,
result
->
cp
-
result
->
match_len
,
result
->
match_len
*
sizeof
(
WCHAR
));
...
...
@@ -391,7 +391,7 @@ static ULONG WINAPI Match2_Release(IMatch2 *iface)
if
(
!
ref
)
{
ISubMatches_Release
(
&
This
->
sub_matches
->
ISubMatches_iface
);
heap_
free
(
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -605,14 +605,14 @@ static HRESULT create_match2(DWORD pos, match_state_t **result, IMatch2 **match)
if
(
FAILED
(
hres
))
return
hres
;
ret
=
heap_alloc_zero
(
sizeof
(
*
ret
));
ret
=
calloc
(
1
,
sizeof
(
*
ret
));
if
(
!
ret
)
return
E_OUTOFMEMORY
;
ret
->
index
=
pos
;
hres
=
create_sub_matches
(
pos
,
result
?
*
result
:
NULL
,
&
ret
->
sub_matches
);
if
(
FAILED
(
hres
))
{
heap_
free
(
ret
);
free
(
ret
);
return
hres
;
}
if
(
result
)
...
...
@@ -671,7 +671,7 @@ static ULONG WINAPI MatchCollectionEnum_Release(IEnumVARIANT *iface)
if
(
!
ref
)
{
IMatchCollection2_Release
(
This
->
mc
);
heap_
free
(
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -754,7 +754,7 @@ static HRESULT create_enum_variant_mc2(IMatchCollection2 *mc, ULONG pos, IEnumVA
{
MatchCollectionEnum
*
ret
;
ret
=
heap_alloc_zero
(
sizeof
(
*
ret
));
ret
=
calloc
(
1
,
sizeof
(
*
ret
));
if
(
!
ret
)
return
E_OUTOFMEMORY
;
...
...
@@ -827,9 +827,9 @@ static ULONG WINAPI MatchCollection2_Release(IMatchCollection2 *iface)
for
(
i
=
0
;
i
<
This
->
count
;
i
++
)
IMatch2_Release
(
This
->
matches
[
i
]);
heap_
free
(
This
->
matches
);
free
(
This
->
matches
);
heap_
free
(
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -1024,12 +1024,12 @@ static HRESULT add_match(IMatchCollection2 *iface, IMatch2 *add)
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
add
);
if
(
!
This
->
size
)
{
This
->
matches
=
heap_
alloc
(
8
*
sizeof
(
IMatch
*
));
This
->
matches
=
m
alloc
(
8
*
sizeof
(
IMatch
*
));
if
(
!
This
->
matches
)
return
E_OUTOFMEMORY
;
This
->
size
=
8
;
}
else
if
(
This
->
size
==
This
->
count
)
{
IMatch2
**
new_matches
=
heap_
realloc
(
This
->
matches
,
2
*
This
->
size
*
sizeof
(
IMatch
*
));
IMatch2
**
new_matches
=
realloc
(
This
->
matches
,
2
*
This
->
size
*
sizeof
(
IMatch
*
));
if
(
!
new_matches
)
return
E_OUTOFMEMORY
;
...
...
@@ -1051,7 +1051,7 @@ static HRESULT create_match_collection2(IMatchCollection2 **match_collection)
if
(
FAILED
(
hres
))
return
hres
;
ret
=
heap_alloc_zero
(
sizeof
(
*
ret
));
ret
=
calloc
(
1
,
sizeof
(
*
ret
));
if
(
!
ret
)
return
E_OUTOFMEMORY
;
...
...
@@ -1116,11 +1116,11 @@ static ULONG WINAPI RegExp2_Release(IRegExp2 *iface)
TRACE
(
"(%p) ref=%ld
\n
"
,
This
,
ref
);
if
(
!
ref
)
{
heap_
free
(
This
->
pattern
);
free
(
This
->
pattern
);
if
(
This
->
regexp
)
regexp_destroy
(
This
->
regexp
);
heap_pool_free
(
&
This
->
pool
);
heap_
free
(
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -1199,7 +1199,7 @@ static HRESULT WINAPI RegExp2_put_Pattern(IRegExp2 *iface, BSTR pattern)
if
(
pattern
&&
*
pattern
)
{
SIZE_T
size
=
(
SysStringLen
(
pattern
)
+
1
)
*
sizeof
(
WCHAR
);
new_pattern
=
heap_
alloc
(
size
);
new_pattern
=
m
alloc
(
size
);
if
(
!
new_pattern
)
return
E_OUTOFMEMORY
;
memcpy
(
new_pattern
,
pattern
,
size
);
...
...
@@ -1207,7 +1207,7 @@ static HRESULT WINAPI RegExp2_put_Pattern(IRegExp2 *iface, BSTR pattern)
new_pattern
=
NULL
;
}
heap_
free
(
This
->
pattern
);
free
(
This
->
pattern
);
This
->
pattern
=
new_pattern
;
if
(
This
->
regexp
)
{
...
...
@@ -1363,13 +1363,13 @@ static HRESULT WINAPI RegExp2_Execute(IRegExp2 *iface,
hres
=
regexp_execute
(
This
->
regexp
,
NULL
,
&
This
->
pool
,
sourceString
,
SysStringLen
(
sourceString
),
result
);
if
(
hres
!=
S_OK
)
{
heap_
free
(
result
);
free
(
result
);
break
;
}
pos
=
result
->
cp
;
hres
=
create_match2
(
result
->
cp
-
result
->
match_len
-
sourceString
,
&
result
,
&
add
);
heap_
free
(
result
);
free
(
result
);
if
(
FAILED
(
hres
))
break
;
hres
=
add_match
(
match_collection
,
add
);
...
...
@@ -1454,9 +1454,9 @@ static BOOL strbuf_ensure_size(strbuf_t *buf, unsigned len)
if
(
new_size
<
len
)
new_size
=
len
;
if
(
buf
->
buf
)
new_buf
=
heap_
realloc
(
buf
->
buf
,
new_size
*
sizeof
(
WCHAR
));
new_buf
=
realloc
(
buf
->
buf
,
new_size
*
sizeof
(
WCHAR
));
else
new_buf
=
heap_
alloc
(
new_size
*
sizeof
(
WCHAR
));
new_buf
=
m
alloc
(
new_size
*
sizeof
(
WCHAR
));
if
(
!
new_buf
)
return
FALSE
;
...
...
@@ -1606,7 +1606,7 @@ static HRESULT WINAPI RegExp2_Replace(IRegExp2 *iface, BSTR source, VARIANT repl
}
heap_pool_clear
(
mark
);
heap_
free
(
buf
.
buf
);
free
(
buf
.
buf
);
SysFreeString
(
replace
);
return
hres
;
}
...
...
@@ -1673,7 +1673,7 @@ BSTR string_replace(BSTR string, BSTR find, BSTR replace, int from, int cnt, int
ret
=
SysAllocStringLen
(
buf
.
buf
,
buf
.
len
);
}
heap_
free
(
buf
.
buf
);
free
(
buf
.
buf
);
return
ret
;
}
...
...
@@ -1817,7 +1817,7 @@ HRESULT create_regexp(IDispatch **ret)
if
(
FAILED
(
hres
))
return
hres
;
regexp
=
heap_alloc_zero
(
sizeof
(
*
regexp
));
regexp
=
calloc
(
1
,
sizeof
(
*
regexp
));
if
(
!
regexp
)
return
E_OUTOFMEMORY
;
...
...
dlls/vbscript/vbscript.c
View file @
796f2822
...
...
@@ -111,9 +111,9 @@ static HRESULT exec_global_code(script_ctx_t *ctx, vbscode_t *code, VARIANT *res
if
(
cnt
>
obj
->
global_vars_size
)
{
if
(
obj
->
global_vars
)
new_vars
=
heap_
realloc
(
obj
->
global_vars
,
cnt
*
sizeof
(
*
new_vars
));
new_vars
=
realloc
(
obj
->
global_vars
,
cnt
*
sizeof
(
*
new_vars
));
else
new_vars
=
heap_
alloc
(
cnt
*
sizeof
(
*
new_vars
));
new_vars
=
m
alloc
(
cnt
*
sizeof
(
*
new_vars
));
if
(
!
new_vars
)
return
E_OUTOFMEMORY
;
obj
->
global_vars
=
new_vars
;
...
...
@@ -126,9 +126,9 @@ static HRESULT exec_global_code(script_ctx_t *ctx, vbscode_t *code, VARIANT *res
if
(
cnt
>
obj
->
global_funcs_size
)
{
if
(
obj
->
global_funcs
)
new_funcs
=
heap_
realloc
(
obj
->
global_funcs
,
cnt
*
sizeof
(
*
new_funcs
));
new_funcs
=
realloc
(
obj
->
global_funcs
,
cnt
*
sizeof
(
*
new_funcs
));
else
new_funcs
=
heap_
alloc
(
cnt
*
sizeof
(
*
new_funcs
));
new_funcs
=
m
alloc
(
cnt
*
sizeof
(
*
new_funcs
));
if
(
!
new_funcs
)
return
E_OUTOFMEMORY
;
obj
->
global_funcs
=
new_funcs
;
...
...
@@ -256,8 +256,8 @@ void release_named_item(named_item_t *item)
{
if
(
--
item
->
ref
)
return
;
heap_
free
(
item
->
name
);
heap_
free
(
item
);
free
(
item
->
name
);
free
(
item
);
}
static
void
release_script
(
script_ctx_t
*
ctx
)
...
...
@@ -408,9 +408,8 @@ static ULONG WINAPI VBScriptError_Release(IActiveScriptError *iface)
TRACE
(
"(%p) ref=%ld
\n
"
,
This
,
ref
);
if
(
!
ref
)
{
heap_free
(
This
);
}
if
(
!
ref
)
free
(
This
);
return
ref
;
}
...
...
@@ -465,7 +464,7 @@ HRESULT report_script_error(script_ctx_t *ctx, const vbscode_t *code, unsigned l
const
WCHAR
*
p
,
*
nl
;
HRESULT
hres
,
result
;
if
(
!
(
error
=
heap_
alloc
(
sizeof
(
*
error
))))
if
(
!
(
error
=
m
alloc
(
sizeof
(
*
error
))))
return
E_OUTOFMEMORY
;
error
->
IActiveScriptError_iface
.
lpVtbl
=
&
VBScriptErrorVtbl
;
...
...
@@ -546,8 +545,8 @@ static ULONG WINAPI VBScript_Release(IActiveScript *iface)
if
(
!
ref
)
{
decrease_state
(
This
,
SCRIPTSTATE_CLOSED
);
detach_global_objects
(
This
->
ctx
);
heap_
free
(
This
->
ctx
);
heap_
free
(
This
);
free
(
This
->
ctx
);
free
(
This
);
}
return
ref
;
...
...
@@ -712,7 +711,7 @@ static HRESULT WINAPI VBScript_AddNamedItem(IActiveScript *iface, LPCOLESTR pstr
}
}
item
=
heap_
alloc
(
sizeof
(
*
item
));
item
=
m
alloc
(
sizeof
(
*
item
));
if
(
!
item
)
{
if
(
disp
)
IDispatch_Release
(
disp
);
...
...
@@ -723,11 +722,11 @@ static HRESULT WINAPI VBScript_AddNamedItem(IActiveScript *iface, LPCOLESTR pstr
item
->
disp
=
disp
;
item
->
flags
=
dwFlags
;
item
->
script_obj
=
NULL
;
item
->
name
=
heap_strdupW
(
pstrName
);
item
->
name
=
wcsdup
(
pstrName
);
if
(
!
item
->
name
)
{
if
(
disp
)
IDispatch_Release
(
disp
);
heap_
free
(
item
);
free
(
item
);
return
E_OUTOFMEMORY
;
}
...
...
@@ -1106,7 +1105,7 @@ HRESULT WINAPI VBScriptFactory_CreateInstance(IClassFactory *iface, IUnknown *pU
TRACE
(
"(%p %s %p)
\n
"
,
pUnkOuter
,
debugstr_guid
(
riid
),
ppv
);
ret
=
heap_alloc_zero
(
sizeof
(
*
ret
));
ret
=
calloc
(
1
,
sizeof
(
*
ret
));
if
(
!
ret
)
return
E_OUTOFMEMORY
;
...
...
@@ -1119,9 +1118,9 @@ HRESULT WINAPI VBScriptFactory_CreateInstance(IClassFactory *iface, IUnknown *pU
ret
->
ref
=
1
;
ret
->
state
=
SCRIPTSTATE_UNINITIALIZED
;
ctx
=
ret
->
ctx
=
heap_alloc_zero
(
sizeof
(
*
ctx
));
ctx
=
ret
->
ctx
=
calloc
(
1
,
sizeof
(
*
ctx
));
if
(
!
ctx
)
{
heap_
free
(
ret
);
free
(
ret
);
return
E_OUTOFMEMORY
;
}
...
...
@@ -1192,7 +1191,7 @@ static ULONG WINAPI AXSite_Release(IServiceProvider *iface)
TRACE
(
"(%p) ref=%ld
\n
"
,
This
,
ref
);
if
(
!
ref
)
heap_
free
(
This
);
free
(
This
);
return
ref
;
}
...
...
@@ -1226,7 +1225,7 @@ IUnknown *create_ax_site(script_ctx_t *ctx)
return
NULL
;
}
ret
=
heap_
alloc
(
sizeof
(
*
ret
));
ret
=
m
alloc
(
sizeof
(
*
ret
));
if
(
!
ret
)
{
IServiceProvider_Release
(
sp
);
return
NULL
;
...
...
dlls/vbscript/vbscript.h
View file @
796f2822
...
...
@@ -31,7 +31,6 @@
#include "vbscript_classes.h"
#include "vbscript_defs.h"
#include "wine/heap.h"
#include "wine/list.h"
typedef
struct
{
...
...
@@ -413,22 +412,6 @@ HRESULT WINAPI VBScriptRegExpFactory_CreateInstance(IClassFactory*,IUnknown*,REF
BSTR
get_vbscript_string
(
int
)
DECLSPEC_HIDDEN
;
static
inline
LPWSTR
heap_strdupW
(
LPCWSTR
str
)
{
LPWSTR
ret
=
NULL
;
if
(
str
)
{
DWORD
size
;
size
=
(
lstrlenW
(
str
)
+
1
)
*
sizeof
(
WCHAR
);
ret
=
heap_alloc
(
size
);
if
(
ret
)
memcpy
(
ret
,
str
,
size
);
}
return
ret
;
}
#define VBSCRIPT_BUILD_VERSION 16978
#define VBSCRIPT_MAJOR_VERSION 5
#define VBSCRIPT_MINOR_VERSION 8
dlls/vbscript/vbscript_main.c
View file @
796f2822
...
...
@@ -66,12 +66,12 @@ void *heap_pool_alloc(heap_pool_t *heap, size_t size)
if
(
!
heap
->
block_cnt
)
{
if
(
!
heap
->
blocks
)
{
heap
->
blocks
=
heap_
alloc
(
sizeof
(
void
*
));
heap
->
blocks
=
m
alloc
(
sizeof
(
void
*
));
if
(
!
heap
->
blocks
)
return
NULL
;
}
tmp
=
heap_
alloc
(
block_size
(
0
));
tmp
=
m
alloc
(
block_size
(
0
));
if
(
!
tmp
)
return
NULL
;
...
...
@@ -87,12 +87,12 @@ void *heap_pool_alloc(heap_pool_t *heap, size_t size)
if
(
size
<=
block_size
(
heap
->
last_block
+
1
))
{
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
)
return
NULL
;
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
])
return
NULL
;
...
...
@@ -104,7 +104,7 @@ void *heap_pool_alloc(heap_pool_t *heap, size_t size)
return
heap
->
blocks
[
heap
->
last_block
];
}
list
=
heap_
alloc
(
size
+
sizeof
(
struct
list
));
list
=
m
alloc
(
size
+
sizeof
(
struct
list
));
if
(
!
list
)
return
NULL
;
...
...
@@ -137,7 +137,7 @@ void heap_pool_clear(heap_pool_t *heap)
while
((
tmp
=
list_next
(
&
heap
->
custom_blocks
,
&
heap
->
custom_blocks
)))
{
list_remove
(
tmp
);
heap_
free
(
tmp
);
free
(
tmp
);
}
if
(
WARN_ON
(
heap
))
{
...
...
@@ -158,8 +158,8 @@ void heap_pool_free(heap_pool_t *heap)
heap_pool_clear
(
heap
);
for
(
i
=
0
;
i
<
heap
->
block_cnt
;
i
++
)
heap_
free
(
heap
->
blocks
[
i
]);
heap_
free
(
heap
->
blocks
);
free
(
heap
->
blocks
[
i
]);
free
(
heap
->
blocks
);
heap_pool_init
(
heap
);
}
...
...
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