Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
bf1486af
Commit
bf1486af
authored
Nov 02, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dnsapi: Use CRT memory allocation functions.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
da65aa5b
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
20 deletions
+20
-20
dnsapi.h
dlls/dnsapi/dnsapi.h
+10
-10
name.c
dlls/dnsapi/name.c
+4
-4
query.c
dlls/dnsapi/query.c
+6
-6
record.c
dlls/dnsapi/record.c
+0
-0
No files found.
dlls/dnsapi/dnsapi.h
View file @
bf1486af
...
...
@@ -18,18 +18,18 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winternl.h"
#include "wine/heap.h"
#include "wine/unixlib.h"
static
inline
char
*
strdup_a
(
const
char
*
src
)
{
char
*
dst
;
if
(
!
src
)
return
NULL
;
dst
=
heap_
alloc
(
(
lstrlenA
(
src
)
+
1
)
*
sizeof
(
char
)
);
dst
=
m
alloc
(
(
lstrlenA
(
src
)
+
1
)
*
sizeof
(
char
)
);
if
(
dst
)
lstrcpyA
(
dst
,
src
);
return
dst
;
}
...
...
@@ -38,7 +38,7 @@ static inline char *strdup_u( const char *src )
{
char
*
dst
;
if
(
!
src
)
return
NULL
;
dst
=
heap_
alloc
(
(
strlen
(
src
)
+
1
)
*
sizeof
(
char
)
);
dst
=
m
alloc
(
(
strlen
(
src
)
+
1
)
*
sizeof
(
char
)
);
if
(
dst
)
strcpy
(
dst
,
src
);
return
dst
;
}
...
...
@@ -47,7 +47,7 @@ static inline WCHAR *strdup_w( const WCHAR *src )
{
WCHAR
*
dst
;
if
(
!
src
)
return
NULL
;
dst
=
heap_
alloc
(
(
lstrlenW
(
src
)
+
1
)
*
sizeof
(
WCHAR
)
);
dst
=
m
alloc
(
(
lstrlenW
(
src
)
+
1
)
*
sizeof
(
WCHAR
)
);
if
(
dst
)
lstrcpyW
(
dst
,
src
);
return
dst
;
}
...
...
@@ -58,7 +58,7 @@ static inline WCHAR *strdup_aw( const char *str )
if
(
str
)
{
DWORD
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
NULL
,
0
);
if
((
ret
=
heap_
alloc
(
len
*
sizeof
(
WCHAR
)
)))
if
((
ret
=
m
alloc
(
len
*
sizeof
(
WCHAR
)
)))
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
ret
,
len
);
}
return
ret
;
...
...
@@ -70,7 +70,7 @@ static inline WCHAR *strdup_uw( const char *str )
if
(
str
)
{
DWORD
len
=
MultiByteToWideChar
(
CP_UTF8
,
0
,
str
,
-
1
,
NULL
,
0
);
if
((
ret
=
heap_
alloc
(
len
*
sizeof
(
WCHAR
)
)))
if
((
ret
=
m
alloc
(
len
*
sizeof
(
WCHAR
)
)))
MultiByteToWideChar
(
CP_UTF8
,
0
,
str
,
-
1
,
ret
,
len
);
}
return
ret
;
...
...
@@ -82,7 +82,7 @@ static inline char *strdup_wa( const WCHAR *str )
if
(
str
)
{
DWORD
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
str
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
if
((
ret
=
heap_
alloc
(
len
)))
if
((
ret
=
m
alloc
(
len
)))
WideCharToMultiByte
(
CP_ACP
,
0
,
str
,
-
1
,
ret
,
len
,
NULL
,
NULL
);
}
return
ret
;
...
...
@@ -94,7 +94,7 @@ static inline char *strdup_wu( const WCHAR *str )
if
(
str
)
{
DWORD
len
=
WideCharToMultiByte
(
CP_UTF8
,
0
,
str
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
if
((
ret
=
heap_
alloc
(
len
)))
if
((
ret
=
m
alloc
(
len
)))
WideCharToMultiByte
(
CP_UTF8
,
0
,
str
,
-
1
,
ret
,
len
,
NULL
,
NULL
);
}
return
ret
;
...
...
@@ -107,7 +107,7 @@ static inline char *strdup_au( const char *src )
if
(
ret
)
{
dst
=
strdup_wu
(
ret
);
heap_
free
(
ret
);
free
(
ret
);
}
return
dst
;
}
...
...
@@ -119,7 +119,7 @@ static inline char *strdup_ua( const char *src )
if
(
ret
)
{
dst
=
strdup_wa
(
ret
);
heap_
free
(
ret
);
free
(
ret
);
}
return
dst
;
}
...
...
dlls/dnsapi/name.c
View file @
bf1486af
...
...
@@ -47,8 +47,8 @@ BOOL WINAPI DnsNameCompare_A( PCSTR name1, PCSTR name2 )
ret
=
DnsNameCompare_W
(
name1W
,
name2W
);
heap_
free
(
name1W
);
heap_
free
(
name2W
);
free
(
name1W
);
free
(
name2W
);
return
ret
;
}
...
...
@@ -89,7 +89,7 @@ DNS_STATUS WINAPI DnsValidateName_A( PCSTR name, DNS_NAME_FORMAT format )
nameW
=
strdup_aw
(
name
);
ret
=
DnsValidateName_W
(
nameW
,
format
);
heap_
free
(
nameW
);
free
(
nameW
);
return
ret
;
}
...
...
@@ -107,7 +107,7 @@ DNS_STATUS WINAPI DnsValidateName_UTF8( PCSTR name, DNS_NAME_FORMAT format )
nameW
=
strdup_uw
(
name
);
ret
=
DnsValidateName_W
(
nameW
,
format
);
heap_
free
(
nameW
);
free
(
nameW
);
return
ret
;
}
...
...
dlls/dnsapi/query.c
View file @
bf1486af
...
...
@@ -65,7 +65,7 @@ static DNS_STATUS do_query_netbios( PCSTR name, DNS_RECORDA **recp )
for
(
i
=
0
;
i
<
header
->
node_count
;
i
++
)
{
record
=
heap_alloc_zero
(
sizeof
(
DNS_RECORDA
)
);
record
=
calloc
(
1
,
sizeof
(
DNS_RECORDA
)
);
if
(
!
record
)
{
status
=
ERROR_NOT_ENOUGH_MEMORY
;
...
...
@@ -156,7 +156,7 @@ DNS_STATUS WINAPI DnsQuery_A( PCSTR name, WORD type, DWORD options, PVOID server
DnsRecordListFree
(
(
DNS_RECORD
*
)
resultW
,
DnsFreeRecordList
);
}
heap_
free
(
nameW
);
free
(
nameW
);
return
status
;
}
...
...
@@ -246,7 +246,7 @@ DNS_STATUS WINAPI DnsQuery_W( PCWSTR name, WORD type, DWORD options, PVOID serve
DnsRecordListFree
(
(
DNS_RECORD
*
)
resultA
,
DnsFreeRecordList
);
}
heap_
free
(
nameU
);
free
(
nameU
);
return
status
;
}
...
...
@@ -306,8 +306,8 @@ static DNS_STATUS get_dns_server_list( IP4_ARRAY *out, DWORD *len )
}
if
(
!
ret
)
break
;
if
((
char
*
)
servers
!=
buf
)
heap_
free
(
servers
);
servers
=
heap_
alloc
(
array_len
);
if
((
char
*
)
servers
!=
buf
)
free
(
servers
);
servers
=
m
alloc
(
array_len
);
if
(
!
servers
)
{
ret
=
ERROR_NOT_ENOUGH_MEMORY
;
...
...
@@ -322,7 +322,7 @@ static DNS_STATUS get_dns_server_list( IP4_ARRAY *out, DWORD *len )
ret
=
ERROR_SUCCESS
;
err:
if
((
char
*
)
servers
!=
buf
)
heap_
free
(
servers
);
if
((
char
*
)
servers
!=
buf
)
free
(
servers
);
return
ret
;
}
...
...
dlls/dnsapi/record.c
View file @
bf1486af
This diff is collapsed.
Click to expand it.
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