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
1b83a376
Commit
1b83a376
authored
Sep 05, 2023
by
Hans Leidekker
Committed by
Alexandre Julliard
Sep 07, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wsdapi/tests: Use CRT allocation functions.
parent
986732a5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
39 deletions
+38
-39
discovery.c
dlls/wsdapi/tests/discovery.c
+36
-37
xml.c
dlls/wsdapi/tests/xml.c
+2
-2
No files found.
dlls/wsdapi/tests/discovery.c
View file @
1b83a376
...
...
@@ -26,7 +26,6 @@
#include <windows.h>
#include "wine/test.h"
#include "wine/heap.h"
#include "initguid.h"
#include "objbase.h"
#include "wsdapi.h"
...
...
@@ -86,7 +85,7 @@ static LPWSTR utf8_to_wide(const char *utf8String)
if
(
sizeNeeded
<=
0
)
return
NULL
;
memLength
=
sizeof
(
WCHAR
)
*
(
sizeNeeded
+
1
);
newString
=
heap_alloc_zero
(
memLength
);
newString
=
calloc
(
1
,
memLength
);
MultiByteToWideChar
(
CP_UTF8
,
0
,
utf8String
,
utf8StringLength
,
newString
,
sizeNeeded
);
return
newString
;
...
...
@@ -175,7 +174,7 @@ static DWORD WINAPI listening_thread(LPVOID lpParam)
int
bytesReceived
;
char
*
buffer
;
buffer
=
heap_
alloc
(
RECEIVE_BUFFER_SIZE
);
buffer
=
m
alloc
(
RECEIVE_BUFFER_SIZE
);
while
(
parameter
->
msgStorage
->
running
)
{
...
...
@@ -193,7 +192,7 @@ static DWORD WINAPI listening_thread(LPVOID lpParam)
if
(
msgStorage
->
messageCount
<
MAX_CACHED_MESSAGES
)
{
msgStorage
->
messages
[
msgStorage
->
messageCount
]
=
heap_
alloc
(
bytesReceived
);
msgStorage
->
messages
[
msgStorage
->
messageCount
]
=
m
alloc
(
bytesReceived
);
if
(
msgStorage
->
messages
[
msgStorage
->
messageCount
]
!=
NULL
)
{
...
...
@@ -215,8 +214,8 @@ static DWORD WINAPI listening_thread(LPVOID lpParam)
closesocket
(
parameter
->
listeningSocket
);
heap_
free
(
buffer
);
heap_
free
(
parameter
);
free
(
buffer
);
free
(
parameter
);
return
0
;
}
...
...
@@ -244,7 +243,7 @@ static BOOL start_listening_udp_unicast(messageStorage *msgStorage, struct socka
goto
cleanup
;
/* Allocate memory for thread parameters */
parameter
=
heap_alloc
(
sizeof
(
listenerThreadParams
));
parameter
=
malloc
(
sizeof
(
*
parameter
));
parameter
->
msgStorage
=
msgStorage
;
parameter
->
listeningSocket
=
s
;
...
...
@@ -259,7 +258,7 @@ static BOOL start_listening_udp_unicast(messageStorage *msgStorage, struct socka
cleanup:
closesocket
(
s
);
heap_
free
(
parameter
);
free
(
parameter
);
return
FALSE
;
}
...
...
@@ -309,7 +308,7 @@ static void start_listening(messageStorage *msgStorage, const char *multicastAdd
if
(
setsockopt
(
s
,
SOL_SOCKET
,
SO_RCVTIMEO
,
(
const
char
*
)
&
receiveTimeout
,
sizeof
(
receiveTimeout
))
==
SOCKET_ERROR
)
goto
cleanup
;
/* Allocate memory for thread parameters */
parameter
=
heap_alloc
(
sizeof
(
listenerThreadParams
));
parameter
=
malloc
(
sizeof
(
*
parameter
));
parameter
->
msgStorage
=
msgStorage
;
parameter
->
listeningSocket
=
s
;
...
...
@@ -324,7 +323,7 @@ static void start_listening(messageStorage *msgStorage, const char *multicastAdd
cleanup:
closesocket
(
s
);
heap_
free
(
parameter
);
free
(
parameter
);
cleanup_addresses:
freeaddrinfo
(
multicastAddr
);
...
...
@@ -346,7 +345,7 @@ static BOOL start_listening_on_all_addresses(messageStorage *msgStorage, ULONG f
if
(
retVal
!=
ERROR_BUFFER_OVERFLOW
)
goto
cleanup
;
/* Get size of buffer for adapters */
adapterAddresses
=
(
IP_ADAPTER_ADDRESSES
*
)
heap_
alloc
(
bufferSize
);
adapterAddresses
=
m
alloc
(
bufferSize
);
if
(
adapterAddresses
==
NULL
)
goto
cleanup
;
/* Get list of adapters */
...
...
@@ -373,7 +372,7 @@ static BOOL start_listening_on_all_addresses(messageStorage *msgStorage, ULONG f
ret
=
TRUE
;
cleanup:
heap_
free
(
adapterAddresses
);
free
(
adapterAddresses
);
return
ret
;
}
...
...
@@ -402,7 +401,7 @@ static BOOL send_udp_multicast_of_type(const char *data, int length, ULONG famil
retval
=
GetAdaptersAddresses
(
family
,
0
,
NULL
,
NULL
,
&
bufferSize
);
if
(
retval
!=
ERROR_BUFFER_OVERFLOW
)
goto
cleanup
;
adapter_addresses
=
(
IP_ADAPTER_ADDRESSES
*
)
heap_
alloc
(
bufferSize
);
adapter_addresses
=
m
alloc
(
bufferSize
);
if
(
adapter_addresses
==
NULL
)
goto
cleanup
;
/* Get list of adapters */
...
...
@@ -438,7 +437,7 @@ static BOOL send_udp_multicast_of_type(const char *data, int length, ULONG famil
cleanup:
freeaddrinfo
(
multi_address
);
heap_
free
(
adapter_addresses
);
free
(
adapter_addresses
);
return
ret
;
}
...
...
@@ -495,7 +494,7 @@ static ULONG WINAPI IWSDiscoveryPublisherNotifyImpl_Release(IWSDiscoveryPublishe
if
(
ref
==
0
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -644,7 +643,7 @@ static HRESULT WINAPI IWSDiscoveryPublisherNotifyImpl_ProbeHandler(IWSDiscoveryP
IWSDUdpAddress_Release
(
remote_addr
);
msg_storage
=
heap_alloc_zero
(
sizeof
(
messageS
torage
));
msg_storage
=
calloc
(
1
,
sizeof
(
*
msg_s
torage
));
if
(
msg_storage
==
NULL
)
goto
after_matchprobe_test
;
msg_storage
->
running
=
TRUE
;
...
...
@@ -736,7 +735,7 @@ static HRESULT WINAPI IWSDiscoveryPublisherNotifyImpl_ProbeHandler(IWSDiscoveryP
for
(
i
=
0
;
i
<
msg_storage
->
messageCount
;
i
++
)
{
heap_
free
(
msg_storage
->
messages
[
i
]);
free
(
msg_storage
->
messages
[
i
]);
}
ok
(
probe_matches_message_seen
==
TRUE
,
"Probe matches message not received
\n
"
);
...
...
@@ -751,9 +750,9 @@ static HRESULT WINAPI IWSDiscoveryPublisherNotifyImpl_ProbeHandler(IWSDiscoveryP
ok
(
types_seen
==
TRUE
,
"Types not received
\n
"
);
after_matchprobe_test:
heap_
free
(
publisherIdW
);
heap_
free
(
sequenceIdW
);
heap_
free
(
msg_storage
);
free
(
publisherIdW
);
free
(
sequenceIdW
);
free
(
msg_storage
);
}
}
}
...
...
@@ -783,7 +782,7 @@ static BOOL create_discovery_publisher_notify(IWSDiscoveryPublisherNotify **publ
*
publisherNotify
=
NULL
;
obj
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
obj
));
obj
=
calloc
(
1
,
sizeof
(
*
obj
));
if
(
!
obj
)
{
...
...
@@ -956,7 +955,7 @@ static void Publish_tests(void)
sequenceIdW
=
utf8_to_wide
(
sequenceId
);
if
(
sequenceIdW
==
NULL
)
goto
after_publish_test
;
msgStorage
=
heap_alloc_zero
(
sizeof
(
message
Storage
));
msgStorage
=
calloc
(
1
,
sizeof
(
*
msg
Storage
));
if
(
msgStorage
==
NULL
)
goto
after_publish_test
;
msgStorage
->
running
=
TRUE
;
...
...
@@ -994,20 +993,20 @@ static void Publish_tests(void)
another_name
.
LocalName
=
(
WCHAR
*
)
name_cider
;
another_name
.
Space
=
&
ns2
;
types_list
.
Next
=
heap_
alloc
(
sizeof
(
WSD_NAME_LIST
));
types_list
.
Next
=
m
alloc
(
sizeof
(
WSD_NAME_LIST
));
types_list
.
Element
=
&
another_name
;
types_list
.
Next
->
Next
=
NULL
;
types_list
.
Next
->
Element
=
&
header_any_name
;
/* Create scopes and xaddrs lists */
scopes_list
.
Next
=
heap_
alloc
(
sizeof
(
WSD_URI_LIST
));
scopes_list
.
Next
=
m
alloc
(
sizeof
(
WSD_URI_LIST
));
scopes_list
.
Element
=
uri
;
scopes_list
.
Next
->
Next
=
NULL
;
scopes_list
.
Next
->
Element
=
uri_more_tests
;
xaddrs_list
.
Next
=
heap_
alloc
(
sizeof
(
WSD_URI_LIST
));
xaddrs_list
.
Next
=
m
alloc
(
sizeof
(
WSD_URI_LIST
));
xaddrs_list
.
Element
=
uri_more_tests
;
xaddrs_list
.
Next
->
Next
=
NULL
;
...
...
@@ -1021,9 +1020,9 @@ static void Publish_tests(void)
WSDFreeLinkedMemory
(
body_any_element
);
WSDFreeLinkedMemory
(
endpoint_any_element
);
WSDFreeLinkedMemory
(
ref_param_any_element
);
heap_
free
(
types_list
.
Next
);
heap_
free
(
scopes_list
.
Next
);
heap_
free
(
xaddrs_list
.
Next
);
free
(
types_list
.
Next
);
free
(
scopes_list
.
Next
);
free
(
xaddrs_list
.
Next
);
ok
(
rc
==
S_OK
,
"Publish failed: %08lx
\n
"
,
rc
);
...
...
@@ -1076,10 +1075,10 @@ static void Publish_tests(void)
for
(
i
=
0
;
i
<
msgStorage
->
messageCount
;
i
++
)
{
heap_
free
(
msgStorage
->
messages
[
i
]);
free
(
msgStorage
->
messages
[
i
]);
}
heap_
free
(
msgStorage
);
free
(
msgStorage
);
ok
(
hello_message_seen
==
TRUE
,
"Hello message not received
\n
"
);
ok
(
endpoint_reference_seen
==
TRUE
,
"EndpointReference not received
\n
"
);
...
...
@@ -1097,8 +1096,8 @@ static void Publish_tests(void)
after_publish_test:
heap_
free
(
publisherIdW
);
heap_
free
(
sequenceIdW
);
free
(
publisherIdW
);
free
(
sequenceIdW
);
/* Test the receiving of a probe message */
probe_event
=
CreateEventW
(
NULL
,
TRUE
,
FALSE
,
NULL
);
...
...
@@ -1172,7 +1171,7 @@ static void UnPublish_tests(void)
sequenceIdW
=
utf8_to_wide
(
sequenceId
);
if
(
sequenceIdW
==
NULL
)
goto
after_unpublish_test
;
msg_storage
=
heap_alloc_zero
(
sizeof
(
messageS
torage
));
msg_storage
=
calloc
(
1
,
sizeof
(
*
msg_s
torage
));
if
(
msg_storage
==
NULL
)
goto
after_unpublish_test
;
msg_storage
->
running
=
TRUE
;
...
...
@@ -1241,10 +1240,10 @@ static void UnPublish_tests(void)
for
(
i
=
0
;
i
<
msg_storage
->
messageCount
;
i
++
)
{
heap_
free
(
msg_storage
->
messages
[
i
]);
free
(
msg_storage
->
messages
[
i
]);
}
heap_
free
(
msg_storage
);
free
(
msg_storage
);
ok
(
hello_message_seen
==
TRUE
,
"Bye message not received
\n
"
);
ok
(
endpoint_reference_seen
==
TRUE
,
"EndpointReference not received
\n
"
);
...
...
@@ -1256,8 +1255,8 @@ static void UnPublish_tests(void)
after_unpublish_test:
heap_
free
(
publisherIdW
);
heap_
free
(
sequenceIdW
);
free
(
publisherIdW
);
free
(
sequenceIdW
);
ref
=
IWSDiscoveryPublisher_Release
(
publisher
);
ok
(
ref
==
0
,
"IWSDiscoveryPublisher_Release() has %ld references, should have 0
\n
"
,
ref
);
...
...
dlls/wsdapi/tests/xml.c
View file @
1b83a376
...
...
@@ -595,7 +595,7 @@ static void XMLContext_AddNameToNamespace_tests(void)
START_TEST
(
xml
)
{
/* Allocate a large text buffer for use in tests */
largeText
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
largeTextSize
+
sizeof
(
WCHAR
));
largeText
=
calloc
(
1
,
largeTextSize
+
sizeof
(
WCHAR
));
memset
(
largeText
,
'a'
,
largeTextSize
);
BuildAnyForSingleElement_tests
();
...
...
@@ -606,5 +606,5 @@ START_TEST(xml)
XMLContext_AddNamespace_tests
();
XMLContext_AddNameToNamespace_tests
();
HeapFree
(
GetProcessHeap
(),
0
,
largeText
);
free
(
largeText
);
}
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