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
0d5f2845
Commit
0d5f2845
authored
Feb 01, 2022
by
Hans Leidekker
Committed by
Alexandre Julliard
Feb 01, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Use CRT allocation functions.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
105d1677
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
33 additions
and
42 deletions
+33
-42
custom.c
dlls/msi/custom.c
+2
-3
handle.c
dlls/msi/handle.c
+3
-3
install.c
dlls/msi/install.c
+8
-9
msipriv.h
dlls/msi/msipriv.h
+5
-11
package.c
dlls/msi/package.c
+7
-8
streams.c
dlls/msi/streams.c
+2
-1
string.c
dlls/msi/string.c
+4
-6
where.c
dlls/msi/where.c
+2
-1
No files found.
dlls/msi/custom.c
View file @
0d5f2845
...
...
@@ -36,7 +36,6 @@
#include "msipriv.h"
#include "winemsi.h"
#include "wine/asm.h"
#include "wine/heap.h"
#include "wine/debug.h"
#include "wine/exception.h"
...
...
@@ -68,12 +67,12 @@ static struct list msi_pending_custom_actions = LIST_INIT( msi_pending_custom_ac
void
__RPC_FAR
*
__RPC_USER
MIDL_user_allocate
(
SIZE_T
len
)
{
return
heap_
alloc
(
len
);
return
m
alloc
(
len
);
}
void
__RPC_USER
MIDL_user_free
(
void
__RPC_FAR
*
ptr
)
{
heap_
free
(
ptr
);
free
(
ptr
);
}
LONG
WINAPI
rpc_filter
(
EXCEPTION_POINTERS
*
eptr
)
...
...
dlls/msi/handle.c
View file @
0d5f2845
...
...
@@ -92,13 +92,13 @@ static MSIHANDLE alloc_handle_table_entry(void)
if
(
msihandletable_size
==
0
)
{
newsize
=
256
;
p
=
msi_alloc_zero
(
newsize
*
sizeof
(
msi_handle_info
));
p
=
msi_alloc_zero
(
newsize
*
sizeof
(
*
p
));
}
else
{
newsize
=
msihandletable_size
*
2
;
p
=
msi_realloc
_zero
(
msihandletable
,
newsize
*
sizeof
(
msi_handle_info
));
p
=
msi_realloc
(
msihandletable
,
newsize
*
sizeof
(
*
p
));
if
(
p
)
memset
(
p
+
msihandletable_size
,
0
,
(
newsize
-
msihandletable_size
)
*
sizeof
(
*
p
));
}
if
(
!
p
)
return
0
;
...
...
dlls/msi/install.c
View file @
0d5f2845
...
...
@@ -34,7 +34,6 @@
#include "msipriv.h"
#include "winemsi.h"
#include "wine/heap.h"
#include "wine/debug.h"
#include "wine/exception.h"
...
...
@@ -273,7 +272,7 @@ UINT WINAPI MsiGetTargetPathA(MSIHANDLE hinst, const char *folder, char *buf, DW
if
(
!
(
remote
=
msi_get_remote
(
hinst
)))
{
heap_
free
(
folderW
);
free
(
folderW
);
return
ERROR_INVALID_HANDLE
;
}
...
...
@@ -291,7 +290,7 @@ UINT WINAPI MsiGetTargetPathA(MSIHANDLE hinst, const char *folder, char *buf, DW
r
=
msi_strncpyWtoA
(
path
,
-
1
,
buf
,
sz
,
TRUE
);
midl_user_free
(
path
);
heap_
free
(
folderW
);
free
(
folderW
);
return
r
;
}
...
...
@@ -301,7 +300,7 @@ UINT WINAPI MsiGetTargetPathA(MSIHANDLE hinst, const char *folder, char *buf, DW
else
r
=
ERROR_DIRECTORY
;
heap_
free
(
folderW
);
free
(
folderW
);
msiobj_release
(
&
package
->
hdr
);
return
r
;
}
...
...
@@ -429,7 +428,7 @@ UINT WINAPI MsiGetSourcePathA(MSIHANDLE hinst, const char *folder, char *buf, DW
if
(
!
(
remote
=
msi_get_remote
(
hinst
)))
{
heap_
free
(
folderW
);
free
(
folderW
);
return
ERROR_INVALID_HANDLE
;
}
...
...
@@ -447,7 +446,7 @@ UINT WINAPI MsiGetSourcePathA(MSIHANDLE hinst, const char *folder, char *buf, DW
r
=
msi_strncpyWtoA
(
path
,
-
1
,
buf
,
sz
,
TRUE
);
midl_user_free
(
path
);
heap_
free
(
folderW
);
free
(
folderW
);
return
r
;
}
...
...
@@ -457,8 +456,8 @@ UINT WINAPI MsiGetSourcePathA(MSIHANDLE hinst, const char *folder, char *buf, DW
else
r
=
ERROR_DIRECTORY
;
heap_
free
(
path
);
heap_
free
(
folderW
);
free
(
path
);
free
(
folderW
);
msiobj_release
(
&
package
->
hdr
);
return
r
;
}
...
...
@@ -509,7 +508,7 @@ UINT WINAPI MsiGetSourcePathW(MSIHANDLE hinst, const WCHAR *folder, WCHAR *buf,
else
r
=
ERROR_DIRECTORY
;
heap_
free
(
path
);
free
(
path
);
msiobj_release
(
&
package
->
hdr
);
return
r
;
}
...
...
dlls/msi/msipriv.h
View file @
0d5f2845
...
...
@@ -1141,30 +1141,24 @@ extern void msi_ui_progress(MSIPACKAGE *, int, int, int, int) DECLSPEC_HIDDEN;
static
void
*
msi_alloc
(
size_t
len
)
__WINE_ALLOC_SIZE
(
1
);
static
inline
void
*
msi_alloc
(
size_t
len
)
{
return
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
return
malloc
(
len
);
}
static
void
*
msi_alloc_zero
(
size_t
len
)
__WINE_ALLOC_SIZE
(
1
);
static
inline
void
*
msi_alloc_zero
(
size_t
len
)
{
return
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
len
);
return
calloc
(
1
,
len
);
}
static
void
*
msi_realloc
(
void
*
mem
,
size_t
len
)
__WINE_ALLOC_SIZE
(
2
);
static
inline
void
*
msi_realloc
(
void
*
mem
,
size_t
len
)
{
return
HeapReAlloc
(
GetProcessHeap
(),
0
,
mem
,
len
);
return
realloc
(
mem
,
len
);
}
static
void
*
msi_realloc_zero
(
void
*
mem
,
size_t
len
)
__WINE_ALLOC_SIZE
(
2
);
static
inline
void
*
msi_realloc_zero
(
void
*
mem
,
size_t
len
)
static
inline
void
msi_free
(
void
*
mem
)
{
return
HeapReAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
mem
,
len
);
}
static
inline
BOOL
msi_free
(
void
*
mem
)
{
return
HeapFree
(
GetProcessHeap
(),
0
,
mem
);
free
(
mem
);
}
static
inline
char
*
strdupWtoA
(
LPCWSTR
str
)
...
...
dlls/msi/package.c
View file @
0d5f2845
...
...
@@ -43,7 +43,6 @@
#include "msidefs.h"
#include "sddl.h"
#include "wine/heap.h"
#include "wine/debug.h"
#include "wine/exception.h"
...
...
@@ -2272,7 +2271,7 @@ UINT WINAPI MsiGetPropertyA(MSIHANDLE hinst, const char *name, char *buf, DWORD
if
(
!
(
remote
=
msi_get_remote
(
hinst
)))
{
heap_
free
(
nameW
);
free
(
nameW
);
return
ERROR_INVALID_HANDLE
;
}
...
...
@@ -2286,13 +2285,13 @@ UINT WINAPI MsiGetPropertyA(MSIHANDLE hinst, const char *name, char *buf, DWORD
}
__ENDTRY
heap_
free
(
nameW
);
free
(
nameW
);
if
(
!
r
)
{
/* String might contain embedded nulls.
* Native returns the correct size but truncates the string. */
tmp
=
heap_alloc_zero
(
(
len
+
1
)
*
sizeof
(
WCHAR
));
tmp
=
calloc
(
1
,
(
len
+
1
)
*
sizeof
(
WCHAR
));
if
(
!
tmp
)
{
midl_user_free
(
value
);
...
...
@@ -2302,7 +2301,7 @@ UINT WINAPI MsiGetPropertyA(MSIHANDLE hinst, const char *name, char *buf, DWORD
r
=
msi_strncpyWtoA
(
tmp
,
len
,
buf
,
sz
,
TRUE
);
heap_
free
(
tmp
);
free
(
tmp
);
}
midl_user_free
(
value
);
return
r
;
...
...
@@ -2314,7 +2313,7 @@ UINT WINAPI MsiGetPropertyA(MSIHANDLE hinst, const char *name, char *buf, DWORD
r
=
msi_strncpyWtoA
(
value
,
len
,
buf
,
sz
,
FALSE
);
heap_
free
(
nameW
);
free
(
nameW
);
if
(
row
)
msiobj_release
(
&
row
->
hdr
);
msiobj_release
(
&
package
->
hdr
);
return
r
;
...
...
@@ -2355,7 +2354,7 @@ UINT WINAPI MsiGetPropertyW(MSIHANDLE hinst, const WCHAR *name, WCHAR *buf, DWOR
{
/* String might contain embedded nulls.
* Native returns the correct size but truncates the string. */
tmp
=
heap_alloc_zero
(
(
len
+
1
)
*
sizeof
(
WCHAR
));
tmp
=
calloc
(
1
,
(
len
+
1
)
*
sizeof
(
WCHAR
));
if
(
!
tmp
)
{
midl_user_free
(
value
);
...
...
@@ -2365,7 +2364,7 @@ UINT WINAPI MsiGetPropertyW(MSIHANDLE hinst, const WCHAR *name, WCHAR *buf, DWOR
r
=
msi_strncpyW
(
tmp
,
len
,
buf
,
sz
);
heap_
free
(
tmp
);
free
(
tmp
);
}
midl_user_free
(
value
);
return
r
;
...
...
dlls/msi/streams.c
View file @
0d5f2845
...
...
@@ -57,7 +57,8 @@ static BOOL streams_resize_table( MSIDATABASE *db, UINT size )
{
MSISTREAM
*
tmp
;
UINT
new_size
=
db
->
num_streams_allocated
*
2
;
if
(
!
(
tmp
=
msi_realloc_zero
(
db
->
streams
,
new_size
*
sizeof
(
MSISTREAM
)
)))
return
FALSE
;
if
(
!
(
tmp
=
msi_realloc
(
db
->
streams
,
new_size
*
sizeof
(
*
tmp
)
)))
return
FALSE
;
memset
(
tmp
+
db
->
num_streams_allocated
,
0
,
(
new_size
-
db
->
num_streams_allocated
)
*
sizeof
(
*
tmp
)
);
db
->
streams
=
tmp
;
db
->
num_streams_allocated
=
new_size
;
}
...
...
dlls/msi/string.c
View file @
0d5f2845
...
...
@@ -139,13 +139,11 @@ static int st_find_free_entry( string_table *st )
return
i
;
/* dynamically resize */
sz
=
st
->
maxcount
+
1
+
st
->
maxcount
/
2
;
p
=
msi_realloc_zero
(
st
->
strings
,
sz
*
sizeof
(
struct
msistring
)
);
if
(
!
p
)
return
-
1
;
sz
=
st
->
maxcount
+
1
+
st
->
maxcount
/
2
;
if
(
!
(
p
=
msi_realloc
(
st
->
strings
,
sz
*
sizeof
(
*
p
)
)))
return
-
1
;
memset
(
p
+
st
->
maxcount
,
0
,
(
sz
-
st
->
maxcount
)
*
sizeof
(
*
p
)
);
s
=
msi_realloc
(
st
->
sorted
,
sz
*
sizeof
(
UINT
)
);
if
(
!
s
)
if
(
!
(
s
=
msi_realloc
(
st
->
sorted
,
sz
*
sizeof
(
*
s
)
)))
{
msi_free
(
p
);
return
-
1
;
...
...
dlls/msi/where.c
View file @
0d5f2845
...
...
@@ -131,9 +131,10 @@ static UINT add_row(MSIWHEREVIEW *wv, UINT vals[])
MSIROWENTRY
**
new_reorder
;
UINT
newsize
=
wv
->
reorder_size
*
2
;
new_reorder
=
msi_realloc
_zero
(
wv
->
reorder
,
sizeof
(
MSIROWENTRY
*
)
*
newsize
);
new_reorder
=
msi_realloc
(
wv
->
reorder
,
newsize
*
sizeof
(
*
new_reorder
)
);
if
(
!
new_reorder
)
return
ERROR_OUTOFMEMORY
;
memset
(
new_reorder
+
wv
->
reorder_size
,
0
,
(
newsize
-
wv
->
reorder_size
)
*
sizeof
(
*
new_reorder
));
wv
->
reorder
=
new_reorder
;
wv
->
reorder_size
=
newsize
;
...
...
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