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
af29c05a
Commit
af29c05a
authored
Aug 02, 2006
by
Mike McCormack
Committed by
Alexandre Julliard
Aug 01, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hlink: Use CoTaskMemAlloc when returning memory to a caller.
parent
dc3d4751
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
40 deletions
+19
-40
link.c
dlls/hlink/link.c
+19
-40
No files found.
dlls/hlink/link.c
View file @
af29c05a
...
@@ -80,6 +80,18 @@ static inline LPWSTR strdupW( LPCWSTR str )
...
@@ -80,6 +80,18 @@ static inline LPWSTR strdupW( LPCWSTR str )
return
r
;
return
r
;
}
}
static
inline
LPWSTR
co_strdupW
(
LPCWSTR
str
)
{
LPWSTR
r
;
if
(
!
str
)
return
NULL
;
r
=
CoTaskMemAlloc
((
lstrlenW
(
str
)
+
1
)
*
sizeof
(
WCHAR
));
if
(
r
)
lstrcpyW
(
r
,
str
);
return
r
;
}
static
inline
void
__GetMoniker
(
HlinkImpl
*
This
,
IMoniker
**
moniker
)
static
inline
void
__GetMoniker
(
HlinkImpl
*
This
,
IMoniker
**
moniker
)
{
{
*
moniker
=
NULL
;
*
moniker
=
NULL
;
...
@@ -281,13 +293,9 @@ static HRESULT WINAPI IHlink_fnGetStringReference (IHlink* iface,
...
@@ -281,13 +293,9 @@ static HRESULT WINAPI IHlink_fnGetStringReference (IHlink* iface,
if
(
ppwzTarget
)
if
(
ppwzTarget
)
{
{
if
(
This
->
Target
)
*
ppwzTarget
=
co_strdupW
(
This
->
Target
);
{
*
ppwzTarget
=
HeapAlloc
(
GetProcessHeap
(),
0
,
if
(
!
This
->
Target
)
(
lstrlenW
(
This
->
Target
)
+
1
)
*
sizeof
(
WCHAR
));
lstrcpyW
(
*
ppwzTarget
,
This
->
Target
);
}
else
{
{
IMoniker
*
mon
;
IMoniker
*
mon
;
__GetMoniker
(
This
,
&
mon
);
__GetMoniker
(
This
,
&
mon
);
...
@@ -296,34 +304,16 @@ static HRESULT WINAPI IHlink_fnGetStringReference (IHlink* iface,
...
@@ -296,34 +304,16 @@ static HRESULT WINAPI IHlink_fnGetStringReference (IHlink* iface,
IBindCtx
*
pbc
;
IBindCtx
*
pbc
;
CreateBindCtx
(
0
,
&
pbc
);
CreateBindCtx
(
0
,
&
pbc
);
IMoniker_GetDisplayName
(
mon
,
pbc
,
NULL
,
&
This
->
Target
);
IMoniker_GetDisplayName
(
mon
,
pbc
,
NULL
,
ppwz
Target
);
IBindCtx_Release
(
pbc
);
IBindCtx_Release
(
pbc
);
*
ppwzTarget
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
This
->
Target
)
+
1
)
*
sizeof
(
WCHAR
));
lstrcpyW
(
*
ppwzTarget
,
This
->
Target
);
IMoniker_Release
(
mon
);
IMoniker_Release
(
mon
);
}
}
else
else
{
FIXME
(
"Unhandled case, no set Target and no moniker
\n
"
);
FIXME
(
"Unhandled case, no set Target and no moniker
\n
"
);
*
ppwzTarget
=
NULL
;
}
}
}
}
}
if
(
ppwzLocation
)
if
(
ppwzLocation
)
{
*
ppwzLocation
=
co_strdupW
(
This
->
Location
);
if
(
This
->
Location
)
{
*
ppwzLocation
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
This
->
Location
)
+
1
)
*
sizeof
(
WCHAR
));
lstrcpyW
(
*
ppwzLocation
,
This
->
Location
);
}
else
{
FIXME
(
"Unhandled case, no explicitly set Location
\n
"
);
*
ppwzLocation
=
NULL
;
}
}
TRACE
(
"(Target: %s Location: %s)
\n
"
,
TRACE
(
"(Target: %s Location: %s)
\n
"
,
(
ppwzTarget
)
?
debugstr_w
(
*
ppwzTarget
)
:
"<NULL>"
,
(
ppwzTarget
)
?
debugstr_w
(
*
ppwzTarget
)
:
"<NULL>"
,
...
@@ -355,11 +345,7 @@ static HRESULT WINAPI IHlink_fnGetFriendlyName (IHlink* iface,
...
@@ -355,11 +345,7 @@ static HRESULT WINAPI IHlink_fnGetFriendlyName (IHlink* iface,
/* FIXME: Only using explicitly set and cached friendly names */
/* FIXME: Only using explicitly set and cached friendly names */
if
(
This
->
FriendlyName
)
if
(
This
->
FriendlyName
)
{
*
ppwzFriendlyName
=
co_strdupW
(
This
->
FriendlyName
);
*
ppwzFriendlyName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
This
->
FriendlyName
)
+
1
)
*
sizeof
(
WCHAR
));
lstrcpyW
(
*
ppwzFriendlyName
,
This
->
FriendlyName
);
}
else
else
{
{
IMoniker
*
moniker
;
IMoniker
*
moniker
;
...
@@ -398,14 +384,7 @@ static HRESULT WINAPI IHlink_fnGetTargetFrameName(IHlink* iface,
...
@@ -398,14 +384,7 @@ static HRESULT WINAPI IHlink_fnGetTargetFrameName(IHlink* iface,
HlinkImpl
*
This
=
(
HlinkImpl
*
)
iface
;
HlinkImpl
*
This
=
(
HlinkImpl
*
)
iface
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
ppwzTargetFrameName
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
ppwzTargetFrameName
);
if
(
This
->
TargetFrameName
)
*
ppwzTargetFrameName
=
co_strdupW
(
This
->
TargetFrameName
);
{
*
ppwzTargetFrameName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
This
->
TargetFrameName
)
+
1
)
*
sizeof
(
WCHAR
));
lstrcpyW
(
*
ppwzTargetFrameName
,
This
->
TargetFrameName
);
}
else
*
ppwzTargetFrameName
=
NULL
;
return
S_OK
;
return
S_OK
;
}
}
...
...
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