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
7c26da1a
Commit
7c26da1a
authored
Nov 17, 2022
by
Alex Henrie
Committed by
Alexandre Julliard
Nov 18, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Use standard C functions for memory allocation in dispex.c.
parent
eabd176c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
31 deletions
+31
-31
dispex.c
dlls/jscript/dispex.c
+31
-31
No files found.
dlls/jscript/dispex.c
View file @
7c26da1a
...
...
@@ -189,7 +189,7 @@ static inline HRESULT resize_props(jsdisp_t *This)
if
(
This
->
buf_size
!=
This
->
prop_cnt
)
return
S_FALSE
;
props
=
heap_realloc
(
This
->
props
,
sizeof
(
dispex_prop_t
)
*
This
->
buf_size
*
2
);
props
=
realloc
(
This
->
props
,
sizeof
(
dispex_prop_t
)
*
This
->
buf_size
*
2
);
if
(
!
props
)
return
E_OUTOFMEMORY
;
This
->
buf_size
*=
2
;
...
...
@@ -220,7 +220,7 @@ static inline dispex_prop_t* alloc_prop(jsdisp_t *This, const WCHAR *name, prop_
return
NULL
;
prop
=
&
This
->
props
[
This
->
prop_cnt
];
prop
->
name
=
heap_strdupW
(
name
);
prop
->
name
=
wcsdup
(
name
);
if
(
!
prop
->
name
)
return
NULL
;
prop
->
type
=
type
;
...
...
@@ -420,7 +420,7 @@ static HRESULT convert_params(script_ctx_t *ctx, const DISPPARAMS *dp, jsval_t *
cnt
=
dp
->
cArgs
-
dp
->
cNamedArgs
;
if
(
cnt
>
6
)
{
argv
=
heap_
alloc
(
cnt
*
sizeof
(
*
argv
));
argv
=
m
alloc
(
cnt
*
sizeof
(
*
argv
));
if
(
!
argv
)
return
E_OUTOFMEMORY
;
}
else
{
...
...
@@ -433,7 +433,7 @@ static HRESULT convert_params(script_ctx_t *ctx, const DISPPARAMS *dp, jsval_t *
while
(
i
--
)
jsval_release
(
argv
[
i
]);
if
(
argv
!=
buf
)
heap_
free
(
argv
);
free
(
argv
);
return
hres
;
}
}
...
...
@@ -775,9 +775,9 @@ static ULONG WINAPI ScriptTypeInfo_Release(ITypeInfo *iface)
for
(
i
=
This
->
num_funcs
;
i
--
;)
release_bytecode
(
This
->
funcs
[
i
].
code
->
bytecode
);
IDispatchEx_Release
(
&
This
->
jsdisp
->
IDispatchEx_iface
);
heap_
free
(
This
->
funcs
);
heap_
free
(
This
->
vars
);
heap_
free
(
This
);
free
(
This
->
funcs
);
free
(
This
->
vars
);
free
(
This
);
}
return
ref
;
}
...
...
@@ -791,7 +791,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_JScriptTypeInfo
;
...
...
@@ -840,7 +840,7 @@ static HRESULT WINAPI ScriptTypeInfo_GetFuncDesc(ITypeInfo *iface, UINT index, F
func
=
&
This
->
funcs
[
index
];
/* Store the parameter array after the FUNCDESC structure */
desc
=
heap_alloc_zero
(
sizeof
(
*
desc
)
+
sizeof
(
ELEMDESC
)
*
func
->
code
->
param_cnt
);
desc
=
calloc
(
1
,
sizeof
(
*
desc
)
+
sizeof
(
ELEMDESC
)
*
func
->
code
->
param_cnt
);
if
(
!
desc
)
return
E_OUTOFMEMORY
;
desc
->
memid
=
prop_to_id
(
This
->
jsdisp
,
func
->
prop
);
...
...
@@ -868,7 +868,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
=
prop_to_id
(
This
->
jsdisp
,
This
->
vars
[
index
]);
...
...
@@ -1213,7 +1213,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
)
...
...
@@ -1222,7 +1222,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
)
...
...
@@ -1231,7 +1231,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
=
{
...
...
@@ -1464,7 +1464,7 @@ static HRESULT WINAPI DispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo, LC
else
num_vars
++
;
}
if
(
!
(
typeinfo
=
heap_
alloc
(
sizeof
(
*
typeinfo
))))
if
(
!
(
typeinfo
=
m
alloc
(
sizeof
(
*
typeinfo
))))
return
E_OUTOFMEMORY
;
typeinfo
->
ITypeInfo_iface
.
lpVtbl
=
&
ScriptTypeInfoVtbl
;
...
...
@@ -1474,18 +1474,18 @@ static HRESULT WINAPI DispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo, LC
typeinfo
->
num_funcs
=
num_funcs
;
typeinfo
->
jsdisp
=
This
;
typeinfo
->
funcs
=
heap_
alloc
(
sizeof
(
*
typeinfo
->
funcs
)
*
num_funcs
);
typeinfo
->
funcs
=
m
alloc
(
sizeof
(
*
typeinfo
->
funcs
)
*
num_funcs
);
if
(
!
typeinfo
->
funcs
)
{
heap_
free
(
typeinfo
);
free
(
typeinfo
);
return
E_OUTOFMEMORY
;
}
typeinfo
->
vars
=
heap_
alloc
(
sizeof
(
*
typeinfo
->
vars
)
*
num_vars
);
typeinfo
->
vars
=
m
alloc
(
sizeof
(
*
typeinfo
->
vars
)
*
num_vars
);
if
(
!
typeinfo
->
vars
)
{
heap_
free
(
typeinfo
->
funcs
);
heap_
free
(
typeinfo
);
free
(
typeinfo
->
funcs
);
free
(
typeinfo
);
return
E_OUTOFMEMORY
;
}
...
...
@@ -1614,7 +1614,7 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
hres
=
jsdisp_call_value
(
This
,
get_this
(
pdp
),
wFlags
,
argc
,
argv
,
pvarRes
?
&
r
:
NULL
);
if
(
argv
!=
buf
)
heap_
free
(
argv
);
free
(
argv
);
if
(
SUCCEEDED
(
hres
)
&&
pvarRes
)
{
hres
=
jsval_to_variant
(
r
,
pvarRes
);
jsval_release
(
r
);
...
...
@@ -1830,7 +1830,7 @@ HRESULT init_dispex(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *b
dispex
->
extensible
=
TRUE
;
dispex
->
prop_cnt
=
0
;
dispex
->
props
=
heap_alloc_zero
(
sizeof
(
dispex_prop_t
)
*
(
dispex
->
buf_size
=
4
));
dispex
->
props
=
calloc
(
1
,
sizeof
(
dispex_prop_t
)
*
(
dispex
->
buf_size
=
4
));
if
(
!
dispex
->
props
)
return
E_OUTOFMEMORY
;
...
...
@@ -1862,13 +1862,13 @@ HRESULT create_dispex(script_ctx_t *ctx, const builtin_info_t *builtin_info, jsd
jsdisp_t
*
ret
;
HRESULT
hres
;
ret
=
heap_alloc_zero
(
sizeof
(
jsdisp_t
));
ret
=
calloc
(
1
,
sizeof
(
jsdisp_t
));
if
(
!
ret
)
return
E_OUTOFMEMORY
;
hres
=
init_dispex
(
ret
,
ctx
,
builtin_info
?
builtin_info
:
&
dispex_info
,
prototype
);
if
(
FAILED
(
hres
))
{
heap_
free
(
ret
);
free
(
ret
);
return
hres
;
}
...
...
@@ -1896,9 +1896,9 @@ void jsdisp_free(jsdisp_t *obj)
default:
break
;
};
heap_
free
(
prop
->
name
);
free
(
prop
->
name
);
}
heap_
free
(
obj
->
props
);
free
(
obj
->
props
);
script_release
(
obj
->
ctx
);
if
(
obj
->
prototype
)
jsdisp_release
(
obj
->
prototype
);
...
...
@@ -1906,7 +1906,7 @@ void jsdisp_free(jsdisp_t *obj)
if
(
obj
->
builtin_info
->
destructor
)
obj
->
builtin_info
->
destructor
(
obj
);
else
heap_
free
(
obj
);
free
(
obj
);
}
#ifdef TRACE_REFCNT
...
...
@@ -2128,7 +2128,7 @@ HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD flags, uns
}
if
(
dp
.
cArgs
>
ARRAY_SIZE
(
buf
))
{
dp
.
rgvarg
=
heap_alloc
(
argc
*
sizeof
(
VARIANT
));
dp
.
rgvarg
=
malloc
(
argc
*
sizeof
(
VARIANT
));
if
(
!
dp
.
rgvarg
)
return
E_OUTOFMEMORY
;
}
else
{
...
...
@@ -2141,7 +2141,7 @@ HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD flags, uns
while
(
i
--
)
VariantClear
(
dp
.
rgvarg
+
argc
-
i
-
1
);
if
(
dp
.
rgvarg
!=
buf
)
heap_
free
(
dp
.
rgvarg
);
free
(
dp
.
rgvarg
);
return
hres
;
}
}
...
...
@@ -2152,7 +2152,7 @@ HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD flags, uns
for
(
i
=
0
;
i
<
argc
;
i
++
)
VariantClear
(
dp
.
rgvarg
+
argc
-
i
-
1
);
if
(
dp
.
rgvarg
!=
buf
)
heap_
free
(
dp
.
rgvarg
);
free
(
dp
.
rgvarg
);
if
(
SUCCEEDED
(
hres
)
&&
ret
)
hres
=
variant_to_jsval
(
ctx
,
&
retv
,
ret
);
...
...
@@ -2223,7 +2223,7 @@ HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, W
dp
.
rgdispidNamedArgs
=
NULL
;
}
if
(
dp
.
cArgs
>
ARRAY_SIZE
(
buf
)
&&
!
(
args
=
heap_
alloc
(
dp
.
cArgs
*
sizeof
(
VARIANT
))))
if
(
dp
.
cArgs
>
ARRAY_SIZE
(
buf
)
&&
!
(
args
=
m
alloc
(
dp
.
cArgs
*
sizeof
(
VARIANT
))))
return
E_OUTOFMEMORY
;
dp
.
rgvarg
=
args
;
...
...
@@ -2243,7 +2243,7 @@ HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, W
for
(
i
=
0
;
i
<
argc
;
i
++
)
VariantClear
(
dp
.
rgvarg
+
dp
.
cArgs
-
i
-
1
);
if
(
args
!=
buf
)
heap_
free
(
args
);
free
(
args
);
if
(
FAILED
(
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