Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lorenzo Ferrillo
wine
Commits
4843f031
Commit
4843f031
authored
12 years ago
by
Jacek Caban
Committed by
Alexandre Julliard
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ole32: Use proper allocators for storing source in ErrorInfoImpl.
parent
12f1fbb7
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/ole32/errorinfo.c
+34
-8
34 additions, 8 deletions
dlls/ole32/errorinfo.c
with
34 additions
and
8 deletions
dlls/ole32/errorinfo.c
+
34
−
8
View file @
4843f031
...
...
@@ -41,6 +41,32 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
ole
);
static
inline
void
*
heap_alloc
(
size_t
len
)
{
return
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
}
static
inline
BOOL
heap_free
(
void
*
mem
)
{
return
HeapFree
(
GetProcessHeap
(),
0
,
mem
);
}
static
inline
WCHAR
*
heap_strdupW
(
const
WCHAR
*
str
)
{
WCHAR
*
ret
=
NULL
;
if
(
str
)
{
size_t
size
;
size
=
(
strlenW
(
str
)
+
1
)
*
sizeof
(
WCHAR
);
ret
=
heap_alloc
(
size
);
if
(
ret
)
memcpy
(
ret
,
str
,
size
);
}
return
ret
;
}
/* this code is from SysAllocStringLen (ole2disp.c in oleaut32) */
static
BSTR
ERRORINFO_SysAllocString
(
const
OLECHAR
*
in
)
{
...
...
@@ -129,7 +155,7 @@ typedef struct ErrorInfoImpl
LONG
ref
;
GUID
m_Guid
;
BSTR
bstrS
ource
;
WCHAR
*
s
ource
;
BSTR
bstrDescription
;
BSTR
bstrHelpFile
;
DWORD
m_dwHelpContext
;
...
...
@@ -203,7 +229,7 @@ static ULONG WINAPI IErrorInfoImpl_Release(
{
TRACE
(
"-- destroying IErrorInfo(%p)
\n
"
,
This
);
ERRORINFO_SysFreeString
(
This
->
bstrS
ource
);
heap_free
(
This
->
s
ource
);
ERRORINFO_SysFreeString
(
This
->
bstrDescription
);
ERRORINFO_SysFreeString
(
This
->
bstrHelpFile
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
...
...
@@ -231,7 +257,7 @@ static HRESULT WINAPI IErrorInfoImpl_GetSource(
TRACE
(
"(%p)->(pBstrSource=%p)
\n
"
,
This
,
pBstrSource
);
if
(
pBstrSource
==
NULL
)
return
E_INVALIDARG
;
*
pBstrSource
=
ERRORINFO_
SysAllocString
(
This
->
bstrS
ource
);
*
pBstrSource
=
SysAllocString
(
This
->
s
ource
);
return
S_OK
;
}
...
...
@@ -329,9 +355,9 @@ static HRESULT WINAPI ICreateErrorInfoImpl_SetSource(
{
ErrorInfoImpl
*
This
=
impl_from_ICreateErrorInfo
(
iface
);
TRACE
(
"(%p): %s
\n
"
,
This
,
debugstr_w
(
szSource
));
if
(
This
->
bstrSource
!=
NULL
)
ERRORINFO_SysFreeString
(
This
->
bstrS
ource
);
This
->
bstrS
ource
=
ERRORINFO_SysAllocString
(
szSource
);
heap_free
(
This
->
s
ource
);
This
->
s
ource
=
heap_strdupW
(
szSource
);
return
S_OK
;
}
...
...
@@ -423,7 +449,7 @@ static const ISupportErrorInfoVtbl SupportErrorInfoVtbl =
static
IErrorInfo
*
IErrorInfoImpl_Constructor
(
void
)
{
ErrorInfoImpl
*
This
=
H
eap
A
lloc
(
GetProcessHeap
(),
0
,
sizeof
(
ErrorInfoImpl
));
ErrorInfoImpl
*
This
=
h
eap
_a
lloc
(
sizeof
(
ErrorInfoImpl
));
if
(
!
This
)
return
NULL
;
...
...
@@ -431,7 +457,7 @@ static IErrorInfo* IErrorInfoImpl_Constructor(void)
This
->
ICreateErrorInfo_iface
.
lpVtbl
=
&
CreateErrorInfoVtbl
;
This
->
ISupportErrorInfo_iface
.
lpVtbl
=
&
SupportErrorInfoVtbl
;
This
->
ref
=
1
;
This
->
bstrS
ource
=
NULL
;
This
->
s
ource
=
NULL
;
This
->
bstrDescription
=
NULL
;
This
->
bstrHelpFile
=
NULL
;
This
->
m_dwHelpContext
=
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment