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
b5c78d0d
Commit
b5c78d0d
authored
Oct 23, 2006
by
Rob Shearman
Committed by
Alexandre Julliard
Oct 23, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32: Rewrite MSFT_ReadName and MSFT_ReadString to need one less allocation…
oleaut32: Rewrite MSFT_ReadName and MSFT_ReadString to need one less allocation and to fix a memory leak.
parent
b3d024a7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
13 deletions
+6
-13
typelib.c
dlls/oleaut32/typelib.c
+6
-13
No files found.
dlls/oleaut32/typelib.c
View file @
b5c78d0d
...
...
@@ -1511,7 +1511,6 @@ static BSTR MSFT_ReadName( TLBContext *pcx, int offset)
char
*
name
;
MSFT_NameIntro
niName
;
int
lengthInChars
;
WCHAR
*
pwstring
=
NULL
;
BSTR
bstrName
=
NULL
;
if
(
offset
<
0
)
...
...
@@ -1532,15 +1531,12 @@ static BSTR MSFT_ReadName( TLBContext *pcx, int offset)
/* no invalid characters in string */
if
(
lengthInChars
)
{
pwstring
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
)
*
lengthInChars
);
bstrName
=
SysAllocStringByteLen
(
NULL
,
lengthInChars
*
sizeof
(
WCHAR
)
);
/* don't check for invalid character since this has been done previously */
MultiByteToWideChar
(
CP_ACP
,
MB_PRECOMPOSED
,
name
,
-
1
,
pwstring
,
lengthInChars
);
bstrName
=
SysAllocStringLen
(
pwstring
,
lengthInChars
);
lengthInChars
=
SysStringLen
(
bstrName
);
HeapFree
(
GetProcessHeap
(),
0
,
pwstring
);
MultiByteToWideChar
(
CP_ACP
,
MB_PRECOMPOSED
,
name
,
-
1
,
bstrName
,
lengthInChars
);
}
TLB_Free
(
name
);
TRACE_
(
typelib
)(
"%s %d
\n
"
,
debugstr_w
(
bstrName
),
lengthInChars
);
return
bstrName
;
...
...
@@ -1566,15 +1562,12 @@ static BSTR MSFT_ReadString( TLBContext *pcx, int offset)
/* no invalid characters in string */
if
(
lengthInChars
)
{
WCHAR
*
pwstring
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
)
*
lengthInChars
);
bstr
=
SysAllocStringByteLen
(
NULL
,
lengthInChars
*
sizeof
(
WCHAR
)
);
/* don't check for invalid character since this has been done previously */
MultiByteToWideChar
(
CP_ACP
,
MB_PRECOMPOSED
,
string
,
-
1
,
pwstring
,
lengthInChars
);
bstr
=
SysAllocStringLen
(
pwstring
,
lengthInChars
);
lengthInChars
=
SysStringLen
(
bstr
);
HeapFree
(
GetProcessHeap
(),
0
,
pwstring
);
MultiByteToWideChar
(
CP_ACP
,
MB_PRECOMPOSED
,
string
,
-
1
,
bstr
,
lengthInChars
);
}
TLB_Free
(
string
);
TRACE_
(
typelib
)(
"%s %d
\n
"
,
debugstr_w
(
bstr
),
lengthInChars
);
return
bstr
;
...
...
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