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
9d7e045c
Commit
9d7e045c
authored
Nov 20, 2022
by
Alex Henrie
Committed by
Alexandre Julliard
Nov 21, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adsldp: Use standard C functions for memory allocation in adsldp.c.
parent
93dcfef0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
41 deletions
+33
-41
adsldp.c
dlls/adsldp/adsldp.c
+33
-33
adsldp_private.h
dlls/adsldp/adsldp_private.h
+0
-8
No files found.
dlls/adsldp/adsldp.c
View file @
9d7e045c
...
...
@@ -99,7 +99,7 @@ static ULONG WINAPI ldap_Release(IParseDisplayName *iface)
if
(
!
ref
)
{
TRACE
(
"destroying %p
\n
"
,
iface
);
heap_
free
(
ldap
);
free
(
ldap
);
}
return
ref
;
...
...
@@ -147,7 +147,7 @@ static HRESULT LDAP_create(REFIID riid, void **obj)
LDAP_PARSE
*
ldap
;
HRESULT
hr
;
ldap
=
heap_
alloc
(
sizeof
(
*
ldap
));
ldap
=
m
alloc
(
sizeof
(
*
ldap
));
if
(
!
ldap
)
return
E_OUTOFMEMORY
;
ldap
->
IParseDisplayName_iface
.
lpVtbl
=
&
LDAP_PARSE_vtbl
;
...
...
@@ -204,7 +204,7 @@ static ULONG WINAPI sysinfo_Release(IADsADSystemInfo *iface)
if
(
!
ref
)
{
TRACE
(
"destroying %p
\n
"
,
iface
);
heap_
free
(
sysinfo
);
free
(
sysinfo
);
}
return
ref
;
...
...
@@ -363,7 +363,7 @@ static HRESULT ADSystemInfo_create(REFIID riid, void **obj)
AD_sysinfo
*
sysinfo
;
HRESULT
hr
;
sysinfo
=
heap_
alloc
(
sizeof
(
*
sysinfo
));
sysinfo
=
m
alloc
(
sizeof
(
*
sysinfo
));
if
(
!
sysinfo
)
return
E_OUTOFMEMORY
;
sysinfo
->
IADsADSystemInfo_iface
.
lpVtbl
=
&
IADsADSystemInfo_vtbl
;
...
...
@@ -484,7 +484,7 @@ static void free_attributes(LDAP_namespace *ldap)
ldap_value_freeW
(
ldap
->
attrs
[
i
].
values
);
}
heap_
free
(
ldap
->
attrs
);
free
(
ldap
->
attrs
);
ldap
->
attrs
=
NULL
;
ldap
->
attrs_count
=
0
;
}
...
...
@@ -502,7 +502,7 @@ static ULONG WINAPI ldapns_Release(IADs *iface)
SysFreeString
(
ldap
->
object
);
free_attributes
(
ldap
);
free_attribute_types
(
ldap
->
at
,
ldap
->
at_single_count
+
ldap
->
at_multiple_count
);
heap_
free
(
ldap
);
free
(
ldap
);
}
return
ref
;
...
...
@@ -693,13 +693,13 @@ static HRESULT add_attribute(LDAP_namespace *ldap, WCHAR *name, WCHAR **values)
if
(
!
ldap
->
attrs
)
{
ldap
->
attrs
=
heap_
alloc
(
256
*
sizeof
(
ldap
->
attrs
[
0
]));
ldap
->
attrs
=
m
alloc
(
256
*
sizeof
(
ldap
->
attrs
[
0
]));
if
(
!
ldap
->
attrs
)
return
E_OUTOFMEMORY
;
ldap
->
attrs_count_allocated
=
256
;
}
else
if
(
ldap
->
attrs_count_allocated
<
ldap
->
attrs_count
+
1
)
{
new_attrs
=
heap_
realloc
(
ldap
->
attrs
,
(
ldap
->
attrs_count_allocated
*
2
)
*
sizeof
(
*
new_attrs
));
new_attrs
=
realloc
(
ldap
->
attrs
,
(
ldap
->
attrs_count_allocated
*
2
)
*
sizeof
(
*
new_attrs
));
if
(
!
new_attrs
)
return
E_OUTOFMEMORY
;
ldap
->
attrs_count_allocated
*=
2
;
...
...
@@ -743,7 +743,7 @@ static HRESULT WINAPI ldapns_GetInfoEx(IADs *iface, VARIANT prop, LONG reserved)
count
=
sa
->
rgsabound
[
0
].
cElements
;
if
(
count
)
{
props
=
heap_
alloc
((
count
+
1
)
*
sizeof
(
props
[
0
]));
props
=
m
alloc
((
count
+
1
)
*
sizeof
(
props
[
0
]));
if
(
!
props
)
{
hr
=
E_OUTOFMEMORY
;
...
...
@@ -798,7 +798,7 @@ static HRESULT WINAPI ldapns_GetInfoEx(IADs *iface, VARIANT prop, LONG reserved)
exit:
if
(
res
)
ldap_msgfree
(
res
);
heap_
free
(
props
);
free
(
props
);
SafeArrayUnaccessData
(
sa
);
return
hr
;
}
...
...
@@ -1309,7 +1309,7 @@ static HRESULT WINAPI search_ExecuteSearch(IDirectorySearch *iface, LPWSTR filte
if
(
!
res
)
return
E_ADS_BAD_PARAMETER
;
ldap_ctx
=
heap_alloc_zero
(
sizeof
(
*
ldap_ctx
));
ldap_ctx
=
calloc
(
1
,
sizeof
(
*
ldap_ctx
));
if
(
!
ldap_ctx
)
return
E_OUTOFMEMORY
;
if
(
count
==
0xffffffff
)
...
...
@@ -1318,14 +1318,14 @@ static HRESULT WINAPI search_ExecuteSearch(IDirectorySearch *iface, LPWSTR filte
{
if
(
count
&&
!
names
)
{
heap_
free
(
ldap_ctx
);
free
(
ldap_ctx
);
return
E_ADS_BAD_PARAMETER
;
}
props
=
heap_
alloc
((
count
+
1
)
*
sizeof
(
props
[
0
]));
props
=
m
alloc
((
count
+
1
)
*
sizeof
(
props
[
0
]));
if
(
!
props
)
{
heap_
free
(
ldap_ctx
);
free
(
ldap_ctx
);
return
E_OUTOFMEMORY
;
}
...
...
@@ -1364,13 +1364,13 @@ static HRESULT WINAPI search_ExecuteSearch(IDirectorySearch *iface, LPWSTR filte
err
=
ldap_search_ext_sW
(
ldap
->
ld
,
ldap
->
object
,
ldap
->
search
.
scope
,
filter
,
props
,
ldap
->
search
.
attribtypes_only
,
ctrls
,
NULL
,
NULL
,
ldap
->
search
.
size_limit
,
&
ldap_ctx
->
res
);
heap_
free
(
props
);
free
(
props
);
if
(
err
!=
LDAP_SUCCESS
)
{
TRACE
(
"ldap_search_sW error %#lx
\n
"
,
err
);
if
(
ldap_ctx
->
page
)
ldap_search_abandon_page
(
ldap
->
ld
,
ldap_ctx
->
page
);
heap_
free
(
ldap_ctx
);
free
(
ldap_ctx
);
return
HRESULT_FROM_WIN32
(
map_ldap_error
(
err
));
}
...
...
@@ -1531,7 +1531,7 @@ static HRESULT add_column_values(LDAP_namespace *ldap, struct ldap_search_contex
return
E_ADS_COLUMN_NOT_SET
;
count
=
ldap_count_valuesW
(
values
);
col
->
pADsValues
=
heap_alloc_zero
(
count
*
sizeof
(
col
->
pADsValues
[
0
]));
col
->
pADsValues
=
calloc
(
count
,
sizeof
(
col
->
pADsValues
[
0
]));
if
(
!
col
->
pADsValues
)
{
ldap_value_freeW
(
values
);
...
...
@@ -1556,7 +1556,7 @@ static HRESULT add_column_values(LDAP_namespace *ldap, struct ldap_search_contex
return
E_ADS_COLUMN_NOT_SET
;
count
=
ldap_count_valuesW
(
values
);
col
->
pADsValues
=
heap_alloc_zero
(
count
*
sizeof
(
col
->
pADsValues
[
0
]));
col
->
pADsValues
=
calloc
(
count
,
sizeof
(
col
->
pADsValues
[
0
]));
if
(
!
col
->
pADsValues
)
{
ldap_value_freeW
(
values
);
...
...
@@ -1592,7 +1592,7 @@ static HRESULT add_column_values(LDAP_namespace *ldap, struct ldap_search_contex
return
E_ADS_COLUMN_NOT_SET
;
count
=
ldap_count_values_len
(
values
);
col
->
pADsValues
=
heap_alloc_zero
(
count
*
sizeof
(
col
->
pADsValues
[
0
]));
col
->
pADsValues
=
calloc
(
count
,
sizeof
(
col
->
pADsValues
[
0
]));
if
(
!
col
->
pADsValues
)
{
ldap_value_free_len
(
values
);
...
...
@@ -1628,7 +1628,7 @@ static HRESULT add_column_values(LDAP_namespace *ldap, struct ldap_search_contex
return
E_ADS_COLUMN_NOT_SET
;
count
=
ldap_count_values_len
(
values
);
col
->
pADsValues
=
heap_alloc_zero
(
count
*
sizeof
(
col
->
pADsValues
[
0
]));
col
->
pADsValues
=
calloc
(
count
,
sizeof
(
col
->
pADsValues
[
0
]));
if
(
!
col
->
pADsValues
)
{
ldap_value_free_len
(
values
);
...
...
@@ -1654,7 +1654,7 @@ static HRESULT add_column_values(LDAP_namespace *ldap, struct ldap_search_contex
return
E_ADS_COLUMN_NOT_SET
;
count
=
ldap_count_values_len
(
values
);
col
->
pADsValues
=
heap_alloc_zero
(
count
*
sizeof
(
col
->
pADsValues
[
0
]));
col
->
pADsValues
=
calloc
(
count
,
sizeof
(
col
->
pADsValues
[
0
]));
if
(
!
col
->
pADsValues
)
{
ldap_value_free_len
(
values
);
...
...
@@ -1708,7 +1708,7 @@ static HRESULT add_column_values(LDAP_namespace *ldap, struct ldap_search_contex
return
E_ADS_COLUMN_NOT_SET
;
count
=
ldap_count_valuesW
(
values
);
col
->
pADsValues
=
heap_alloc_zero
(
count
*
(
sizeof
(
col
->
pADsValues
[
0
])
+
sizeof
(
col
->
pADsValues
[
0
].
u
.
pDNWithBinary
[
0
])
));
col
->
pADsValues
=
calloc
(
count
,
sizeof
(
col
->
pADsValues
[
0
])
+
sizeof
(
col
->
pADsValues
[
0
].
u
.
pDNWithBinary
[
0
]
));
if
(
!
col
->
pADsValues
)
{
ldap_value_freeW
(
values
);
...
...
@@ -1766,7 +1766,7 @@ static HRESULT add_column_values(LDAP_namespace *ldap, struct ldap_search_contex
col
->
dwADsType
=
type
;
col
->
dwNumValues
=
count
;
col
->
pszAttrName
=
strdupW
(
name
);
col
->
pszAttrName
=
wcsdup
(
name
);
return
S_OK
;
}
...
...
@@ -1789,7 +1789,7 @@ static HRESULT WINAPI search_GetColumn(IDirectorySearch *iface, ADS_SEARCH_HANDL
{
WCHAR
*
dn
=
ldap_get_dnW
(
ldap
->
ld
,
ldap_ctx
->
entry
);
col
->
pADsValues
=
heap_
alloc
(
sizeof
(
col
->
pADsValues
[
0
]));
col
->
pADsValues
=
m
alloc
(
sizeof
(
col
->
pADsValues
[
0
]));
if
(
!
col
->
pADsValues
)
{
hr
=
E_OUTOFMEMORY
;
...
...
@@ -1799,7 +1799,7 @@ static HRESULT WINAPI search_GetColumn(IDirectorySearch *iface, ADS_SEARCH_HANDL
count
=
sizeof
(
L"LDAP://"
)
+
(
wcslen
(
ldap
->
host
)
+
1
/* '/' */
)
*
sizeof
(
WCHAR
);
if
(
dn
)
count
+=
wcslen
(
dn
)
*
sizeof
(
WCHAR
);
col
->
pADsValues
[
0
].
u
.
CaseIgnoreString
=
heap_
alloc
(
count
);
col
->
pADsValues
[
0
].
u
.
CaseIgnoreString
=
m
alloc
(
count
);
if
(
!
col
->
pADsValues
[
0
].
u
.
CaseIgnoreString
)
{
hr
=
E_OUTOFMEMORY
;
...
...
@@ -1813,7 +1813,7 @@ static HRESULT WINAPI search_GetColumn(IDirectorySearch *iface, ADS_SEARCH_HANDL
col
->
pADsValues
[
0
].
dwType
=
ADSTYPE_CASE_IGNORE_STRING
;
col
->
dwADsType
=
ADSTYPE_CASE_IGNORE_STRING
;
col
->
dwNumValues
=
1
;
col
->
pszAttrName
=
strdupW
(
name
);
col
->
pszAttrName
=
wcsdup
(
name
);
col
->
hReserved
=
NULL
;
TRACE
(
"=> %s
\n
"
,
debugstr_w
(
col
->
pADsValues
[
0
].
u
.
CaseIgnoreString
));
...
...
@@ -1833,9 +1833,9 @@ static HRESULT WINAPI search_FreeColumn(IDirectorySearch *iface, PADS_SEARCH_COL
if
(
!
col
)
return
E_ADS_BAD_PARAMETER
;
if
(
!
wcsicmp
(
col
->
pszAttrName
,
L"ADsPath"
))
heap_
free
(
col
->
pADsValues
[
0
].
u
.
CaseIgnoreString
);
heap_
free
(
col
->
pADsValues
);
heap_
free
(
col
->
pszAttrName
);
free
(
col
->
pADsValues
[
0
].
u
.
CaseIgnoreString
);
free
(
col
->
pADsValues
);
free
(
col
->
pszAttrName
);
if
(
col
->
hReserved
)
{
...
...
@@ -1863,7 +1863,7 @@ static HRESULT WINAPI search_CloseSearchHandle(IDirectorySearch *iface, ADS_SEAR
ldap_msgfree
(
ldap_ctx
->
res
);
if
(
ldap_ctx
->
ber
)
ber_free
(
ldap_ctx
->
ber
,
0
);
heap_
free
(
ldap_ctx
);
free
(
ldap_ctx
);
return
S_OK
;
}
...
...
@@ -1971,7 +1971,7 @@ static HRESULT LDAPNamespace_create(REFIID riid, void **obj)
LDAP_namespace
*
ldap
;
HRESULT
hr
;
ldap
=
heap_
alloc
(
sizeof
(
*
ldap
));
ldap
=
m
alloc
(
sizeof
(
*
ldap
));
if
(
!
ldap
)
return
E_OUTOFMEMORY
;
ldap
->
IADs_iface
.
lpVtbl
=
&
IADs_vtbl
;
...
...
@@ -2061,7 +2061,7 @@ static ULONG WINAPI factory_Release(IClassFactory *iface)
TRACE
(
"(%p) ref %lu
\n
"
,
iface
,
ref
);
if
(
!
ref
)
heap_
free
(
factory
);
free
(
factory
);
return
ref
;
}
...
...
@@ -2100,7 +2100,7 @@ static HRESULT factory_constructor(const struct class_info *info, REFIID riid, v
class_factory
*
factory
;
HRESULT
hr
;
factory
=
heap_
alloc
(
sizeof
(
*
factory
));
factory
=
m
alloc
(
sizeof
(
*
factory
));
if
(
!
factory
)
return
E_OUTOFMEMORY
;
factory
->
IClassFactory_iface
.
lpVtbl
=
&
factory_vtbl
;
...
...
dlls/adsldp/adsldp_private.h
View file @
9d7e045c
...
...
@@ -21,14 +21,6 @@
#include "wine/heap.h"
static
inline
WCHAR
*
strdupW
(
const
WCHAR
*
src
)
{
WCHAR
*
dst
;
if
(
!
src
)
return
NULL
;
if
((
dst
=
heap_alloc
((
wcslen
(
src
)
+
1
)
*
sizeof
(
WCHAR
))))
wcscpy
(
dst
,
src
);
return
dst
;
}
static
inline
LPWSTR
strnUtoW
(
LPCSTR
str
,
DWORD
inlen
,
DWORD
*
outlen
)
{
LPWSTR
ret
=
NULL
;
...
...
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