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
15cbe497
Commit
15cbe497
authored
Nov 07, 2022
by
Alex Henrie
Committed by
Alexandre Julliard
Nov 10, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mscoree: Use standard C functions for memory allocation in assembly.c.
The big win here is getting rid of the reimplementation of wcsdup.
parent
06321ba5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
21 deletions
+7
-21
assembly.c
dlls/mscoree/assembly.c
+7
-21
No files found.
dlls/mscoree/assembly.c
View file @
15cbe497
...
@@ -79,20 +79,6 @@ struct tagASSEMBLY
...
@@ -79,20 +79,6 @@ struct tagASSEMBLY
METADATAHDR
*
metadatahdr
;
METADATAHDR
*
metadatahdr
;
};
};
static
inline
LPWSTR
strdupW
(
LPCWSTR
src
)
{
LPWSTR
dest
;
if
(
!
src
)
return
NULL
;
dest
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
src
)
+
1
)
*
sizeof
(
WCHAR
));
if
(
dest
)
lstrcpyW
(
dest
,
src
);
return
dest
;
}
static
void
*
assembly_rva_to_va
(
ASSEMBLY
*
assembly
,
ULONG
rva
)
static
void
*
assembly_rva_to_va
(
ASSEMBLY
*
assembly
,
ULONG
rva
)
{
{
if
(
assembly
->
is_mapped_file
)
if
(
assembly
->
is_mapped_file
)
...
@@ -130,7 +116,7 @@ static HRESULT parse_metadata_header(ASSEMBLY *assembly, DWORD *hdrsz)
...
@@ -130,7 +116,7 @@ static HRESULT parse_metadata_header(ASSEMBLY *assembly, DWORD *hdrsz)
metadatahdr
=
(
METADATAHDR
*
)
ptr
;
metadatahdr
=
(
METADATAHDR
*
)
ptr
;
assembly
->
metadatahdr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
METADATAHDR
));
assembly
->
metadatahdr
=
malloc
(
sizeof
(
METADATAHDR
));
if
(
!
assembly
->
metadatahdr
)
if
(
!
assembly
->
metadatahdr
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -210,13 +196,13 @@ HRESULT assembly_create(ASSEMBLY **out, LPCWSTR file)
...
@@ -210,13 +196,13 @@ HRESULT assembly_create(ASSEMBLY **out, LPCWSTR file)
*
out
=
NULL
;
*
out
=
NULL
;
assembly
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
ASSEMBLY
));
assembly
=
calloc
(
1
,
sizeof
(
ASSEMBLY
));
if
(
!
assembly
)
if
(
!
assembly
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
assembly
->
is_mapped_file
=
TRUE
;
assembly
->
is_mapped_file
=
TRUE
;
assembly
->
path
=
strdupW
(
file
);
assembly
->
path
=
wcsdup
(
file
);
if
(
!
assembly
->
path
)
if
(
!
assembly
->
path
)
{
{
hr
=
E_OUTOFMEMORY
;
hr
=
E_OUTOFMEMORY
;
...
@@ -264,7 +250,7 @@ HRESULT assembly_from_hmodule(ASSEMBLY **out, HMODULE hmodule)
...
@@ -264,7 +250,7 @@ HRESULT assembly_from_hmodule(ASSEMBLY **out, HMODULE hmodule)
*
out
=
NULL
;
*
out
=
NULL
;
assembly
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
ASSEMBLY
));
assembly
=
calloc
(
1
,
sizeof
(
ASSEMBLY
));
if
(
!
assembly
)
if
(
!
assembly
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -292,9 +278,9 @@ HRESULT assembly_release(ASSEMBLY *assembly)
...
@@ -292,9 +278,9 @@ HRESULT assembly_release(ASSEMBLY *assembly)
CloseHandle
(
assembly
->
hmap
);
CloseHandle
(
assembly
->
hmap
);
CloseHandle
(
assembly
->
hfile
);
CloseHandle
(
assembly
->
hfile
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
assembly
->
metadatahdr
);
free
(
assembly
->
metadatahdr
);
HeapFree
(
GetProcessHeap
(),
0
,
assembly
->
path
);
free
(
assembly
->
path
);
HeapFree
(
GetProcessHeap
(),
0
,
assembly
);
free
(
assembly
);
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