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
776eebe8
Commit
776eebe8
authored
May 02, 2016
by
Alex Henrie
Committed by
Alexandre Julliard
May 05, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Fix memory leak in FileMonikerImpl_ComposeWith.
Signed-off-by:
Alex Henrie
<
alexhenrie24@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e68e03c7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
24 deletions
+24
-24
filemoniker.c
dlls/ole32/filemoniker.c
+24
-24
No files found.
dlls/ole32/filemoniker.c
View file @
776eebe8
...
@@ -694,39 +694,39 @@ FileMonikerImpl_ComposeWith(IMoniker* iface, IMoniker* pmkRight,
...
@@ -694,39 +694,39 @@ FileMonikerImpl_ComposeWith(IMoniker* iface, IMoniker* pmkRight,
lastIdx2
=
FileMonikerImpl_DecomposePath
(
str2
,
&
strDec2
)
-
1
;
lastIdx2
=
FileMonikerImpl_DecomposePath
(
str2
,
&
strDec2
)
-
1
;
if
((
lastIdx1
==-
1
&&
lastIdx2
>-
1
)
||
(
lastIdx1
==
1
&&
lstrcmpW
(
strDec1
[
0
],
twoPoint
)
==
0
))
if
((
lastIdx1
==-
1
&&
lastIdx2
>-
1
)
||
(
lastIdx1
==
1
&&
lstrcmpW
(
strDec1
[
0
],
twoPoint
)
==
0
))
re
turn
MK_E_SYNTAX
;
re
s
=
MK_E_SYNTAX
;
else
{
if
(
lstrcmpW
(
strDec1
[
lastIdx1
],
bkSlash
)
==
0
)
if
(
lstrcmpW
(
strDec1
[
lastIdx1
],
bkSlash
)
==
0
)
lastIdx1
--
;
lastIdx1
--
;
/* for et
ch "..\" in the left of str2 remove the right element from str1 */
/* for ea
ch "..\" in the left of str2 remove the right element from str1 */
for
(
i
=
0
;
(
(
lastIdx1
>=
0
)
&&
(
strDec2
[
i
]
!=
NULL
)
&&
(
lstrcmpW
(
strDec2
[
i
],
twoPoint
)
==
0
)
)
;
i
+=
2
){
for
(
i
=
0
;
(
(
lastIdx1
>=
0
)
&&
(
strDec2
[
i
]
!=
NULL
)
&&
(
lstrcmpW
(
strDec2
[
i
],
twoPoint
)
==
0
)
);
i
+=
2
){
lastIdx1
-=
2
;
lastIdx1
-=
2
;
}
}
/* the length of the composed path string is raised by the sum of the two paths lengths
*/
/* the length of the composed path string is increased by the sum of the two paths' lengths
*/
newStr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
)
*
(
lstrlenW
(
str1
)
+
lstrlenW
(
str2
)
+
1
));
newStr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
)
*
(
lstrlenW
(
str1
)
+
lstrlenW
(
str2
)
+
1
));
if
(
newStr
)
if
(
newStr
){
{
/* new path is the concatenation of the rest of str1 and str2 */
/* new path is the concatenation of the rest of str1 and str2 */
for
(
*
newStr
=
0
,
j
=
0
;
j
<=
lastIdx1
;
j
++
)
for
(
*
newStr
=
0
,
j
=
0
;
j
<=
lastIdx1
;
j
++
)
strcatW
(
newStr
,
strDec1
[
j
]);
strcatW
(
newStr
,
strDec1
[
j
]);
if
((
strDec2
[
i
]
==
NULL
&&
lastIdx1
>-
1
&&
lastIdx2
>-
1
)
||
lstrcmpW
(
strDec2
[
i
],
bkSlash
)
!=
0
)
if
((
strDec2
[
i
]
==
NULL
&&
lastIdx1
>-
1
&&
lastIdx2
>-
1
)
||
lstrcmpW
(
strDec2
[
i
],
bkSlash
)
!=
0
)
strcatW
(
newStr
,
bkSlash
);
strcatW
(
newStr
,
bkSlash
);
for
(
j
=
i
;
j
<=
lastIdx2
;
j
++
)
for
(
j
=
i
;
j
<=
lastIdx2
;
j
++
)
strcatW
(
newStr
,
strDec2
[
j
]);
strcatW
(
newStr
,
strDec2
[
j
]);
/* create a new moniker with the new string */
/* create a new moniker with the new string */
res
=
CreateFileMoniker
(
newStr
,
ppmkComposite
);
res
=
CreateFileMoniker
(
newStr
,
ppmkComposite
);
/* free all strings space memory used by this function */
/* free string memory used by this function */
HeapFree
(
GetProcessHeap
(),
0
,
newStr
);
HeapFree
(
GetProcessHeap
(),
0
,
newStr
);
}
else
res
=
E_OUTOFMEMORY
;
}
}
else
res
=
E_OUTOFMEMORY
;
free_stringtable
(
strDec1
);
free_stringtable
(
strDec1
);
free_stringtable
(
strDec2
);
free_stringtable
(
strDec2
);
...
...
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