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
26be4fb9
Commit
26be4fb9
authored
Nov 15, 2022
by
Alex Henrie
Committed by
Alexandre Julliard
Nov 16, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dpnet: Use standard C functions for memory allocation in address.c.
parent
e6869fe9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
33 deletions
+24
-33
address.c
dlls/dpnet/address.c
+24
-33
No files found.
dlls/dpnet/address.c
View file @
26be4fb9
...
...
@@ -36,22 +36,13 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
dpnet
);
static
char
*
heap_strdupA
(
const
char
*
str
)
{
char
*
ret
;
if
(
!
str
)
return
NULL
;
if
((
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
str
)
+
1
)))
strcpy
(
ret
,
str
);
return
ret
;
}
static
BOOL
add_component
(
IDirectPlay8AddressImpl
*
This
,
struct
component
*
item
)
{
if
(
This
->
comp_count
==
This
->
comp_array_size
)
{
struct
component
**
temp
;
temp
=
heap_realloc
(
This
->
components
,
sizeof
(
*
temp
)
*
This
->
comp_array_size
*
2
);
temp
=
realloc
(
This
->
components
,
sizeof
(
*
temp
)
*
This
->
comp_array_size
*
2
);
if
(
!
temp
)
{
return
FALSE
;
...
...
@@ -115,22 +106,22 @@ static ULONG WINAPI IDirectPlay8AddressImpl_Release(IDirectPlay8Address *iface)
switch
(
entry
->
type
)
{
case
DPNA_DATATYPE_STRING
:
heap_
free
(
entry
->
data
.
string
);
free
(
entry
->
data
.
string
);
break
;
case
DPNA_DATATYPE_STRING_ANSI
:
heap_
free
(
entry
->
data
.
ansi
);
free
(
entry
->
data
.
ansi
);
break
;
case
DPNA_DATATYPE_BINARY
:
heap_
free
(
entry
->
data
.
binary
);
free
(
entry
->
data
.
binary
);
break
;
}
heap_
free
(
entry
->
name
);
heap_
free
(
entry
);
free
(
entry
->
name
);
free
(
entry
);
}
heap_
free
(
This
->
components
);
heap_
free
(
This
);
free
(
This
->
components
);
free
(
This
);
}
return
ref
;
}
...
...
@@ -326,7 +317,7 @@ static HRESULT WINAPI IDirectPlay8AddressImpl_GetURLA(IDirectPlay8Address *iface
return
DPNERR_INVALIDPOINTER
;
if
(
url
&&
*
length
)
buffer
=
heap_
alloc
(
*
length
*
sizeof
(
WCHAR
));
buffer
=
m
alloc
(
*
length
*
sizeof
(
WCHAR
));
hr
=
IDirectPlay8Address_GetURLW
(
iface
,
buffer
,
length
);
if
(
hr
==
DPN_OK
)
...
...
@@ -341,7 +332,7 @@ static HRESULT WINAPI IDirectPlay8AddressImpl_GetURLA(IDirectPlay8Address *iface
hr
=
DPNERR_BUFFERTOOSMALL
;
}
}
heap_
free
(
buffer
);
free
(
buffer
);
return
hr
;
}
...
...
@@ -589,11 +580,11 @@ static HRESULT WINAPI IDirectPlay8AddressImpl_AddComponent(IDirectPlay8Address *
found
=
TRUE
;
if
(
entry
->
type
==
DPNA_DATATYPE_STRING_ANSI
)
heap_
free
(
entry
->
data
.
ansi
);
free
(
entry
->
data
.
ansi
);
else
if
(
entry
->
type
==
DPNA_DATATYPE_STRING
)
heap_
free
(
entry
->
data
.
string
);
free
(
entry
->
data
.
string
);
else
if
(
entry
->
type
==
DPNA_DATATYPE_BINARY
)
heap_
free
(
entry
->
data
.
binary
);
free
(
entry
->
data
.
binary
);
break
;
}
...
...
@@ -602,21 +593,21 @@ static HRESULT WINAPI IDirectPlay8AddressImpl_AddComponent(IDirectPlay8Address *
if
(
!
found
)
{
/* Create a new one */
entry
=
heap_
alloc
(
sizeof
(
struct
component
));
entry
=
m
alloc
(
sizeof
(
struct
component
));
if
(
!
entry
)
return
E_OUTOFMEMORY
;
entry
->
name
=
heap_strdupW
(
pwszName
);
entry
->
name
=
wcsdup
(
pwszName
);
if
(
!
entry
->
name
)
{
heap_
free
(
entry
);
free
(
entry
);
return
E_OUTOFMEMORY
;
}
if
(
!
add_component
(
This
,
entry
))
{
heap_
free
(
entry
->
name
);
heap_
free
(
entry
);
free
(
entry
->
name
);
free
(
entry
);
return
E_OUTOFMEMORY
;
}
}
...
...
@@ -632,15 +623,15 @@ static HRESULT WINAPI IDirectPlay8AddressImpl_AddComponent(IDirectPlay8Address *
TRACE
(
"(%p, %lu): GUID Type -> %s
\n
"
,
lpvData
,
dwDataSize
,
debugstr_guid
(
lpvData
));
break
;
case
DPNA_DATATYPE_STRING
:
entry
->
data
.
string
=
heap_strdupW
((
WCHAR
*
)
lpvData
);
entry
->
data
.
string
=
wcsdup
((
WCHAR
*
)
lpvData
);
TRACE
(
"(%p, %lu): STRING Type -> %s
\n
"
,
lpvData
,
dwDataSize
,
debugstr_w
((
WCHAR
*
)
lpvData
));
break
;
case
DPNA_DATATYPE_STRING_ANSI
:
entry
->
data
.
ansi
=
heap_strdupA
((
CHAR
*
)
lpvData
);
entry
->
data
.
ansi
=
strdup
((
char
*
)
lpvData
);
TRACE
(
"(%p, %lu): ANSI STRING Type -> %s
\n
"
,
lpvData
,
dwDataSize
,
(
const
CHAR
*
)
lpvData
);
break
;
case
DPNA_DATATYPE_BINARY
:
entry
->
data
.
binary
=
heap_
alloc
(
dwDataSize
);
entry
->
data
.
binary
=
m
alloc
(
dwDataSize
);
memcpy
(
entry
->
data
.
binary
,
lpvData
,
dwDataSize
);
TRACE
(
"(%p, %lu): BINARY Type
\n
"
,
lpvData
,
dwDataSize
);
break
;
...
...
@@ -709,17 +700,17 @@ HRESULT DPNET_CreateDirectPlay8Address(IClassFactory *iface, IUnknown *pUnkOuter
*
ppobj
=
NULL
;
client
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
IDirectPlay8AddressImpl
));
client
=
calloc
(
1
,
sizeof
(
IDirectPlay8AddressImpl
));
if
(
!
client
)
return
E_OUTOFMEMORY
;
client
->
IDirectPlay8Address_iface
.
lpVtbl
=
&
DirectPlay8Address_Vtbl
;
client
->
ref
=
1
;
client
->
comp_array_size
=
4
;
client
->
components
=
heap_alloc
(
sizeof
(
*
client
->
components
)
*
client
->
comp_array_size
);
client
->
components
=
malloc
(
sizeof
(
*
client
->
components
)
*
client
->
comp_array_size
);
if
(
!
client
->
components
)
{
heap_
free
(
client
);
free
(
client
);
return
E_OUTOFMEMORY
;
}
...
...
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