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
1fb28509
Commit
1fb28509
authored
Mar 30, 2022
by
Hans Leidekker
Committed by
Alexandre Julliard
Mar 30, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Consistently use CryptMemAlloc/Free().
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
dd91e541
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
24 deletions
+21
-24
cert.c
dlls/crypt32/cert.c
+6
-6
chain.c
dlls/crypt32/chain.c
+2
-2
msg.c
dlls/crypt32/msg.c
+2
-2
pfx.c
dlls/crypt32/pfx.c
+5
-7
rootstore.c
dlls/crypt32/rootstore.c
+4
-5
serialize.c
dlls/crypt32/serialize.c
+2
-2
No files found.
dlls/crypt32/cert.c
View file @
1fb28509
...
...
@@ -677,7 +677,7 @@ static BOOL CertContext_SetKeyProvInfoProperty(CONTEXT_PROPERTY_LIST *properties
for
(
i
=
0
;
i
<
info
->
cProvParam
;
i
++
)
size
+=
sizeof
(
CRYPT_KEY_PROV_PARAM
)
+
info
->
rgProvParam
[
i
].
cbData
;
prop
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
prop
=
CryptMemAlloc
(
size
);
if
(
!
prop
)
{
SetLastError
(
ERROR_OUTOFMEMORY
);
...
...
@@ -687,7 +687,7 @@ static BOOL CertContext_SetKeyProvInfoProperty(CONTEXT_PROPERTY_LIST *properties
copy_KeyProvInfoProperty
(
info
,
prop
);
ret
=
ContextPropertyList_SetProperty
(
properties
,
CERT_KEY_PROV_INFO_PROP_ID
,
(
const
BYTE
*
)
prop
,
size
);
HeapFree
(
GetProcessHeap
(),
0
,
prop
);
CryptMemFree
(
prop
);
return
ret
;
}
...
...
@@ -865,7 +865,7 @@ static BOOL CRYPT_AcquirePrivateKeyFromProvInfo(PCCERT_CONTEXT pCert, DWORD dwFl
CERT_KEY_PROV_INFO_PROP_ID
,
0
,
&
size
);
if
(
ret
)
{
info
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
info
=
CryptMemAlloc
(
size
);
if
(
info
)
{
ret
=
CertGetCertificateContextProperty
(
pCert
,
...
...
@@ -901,7 +901,7 @@ static BOOL CRYPT_AcquirePrivateKeyFromProvInfo(PCCERT_CONTEXT pCert, DWORD dwFl
SetLastError
(
CRYPT_E_NO_KEY_PROPERTY
);
}
if
(
allocated
)
HeapFree
(
GetProcessHeap
(),
0
,
info
);
CryptMemFree
(
info
);
return
ret
;
}
...
...
@@ -953,7 +953,7 @@ BOOL WINAPI CryptAcquireCertificatePrivateKey(PCCERT_CONTEXT pCert,
if
(
ret
)
{
info
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
info
=
CryptMemAlloc
(
size
);
ret
=
CertGetCertificateContextProperty
(
pCert
,
CERT_KEY_PROV_INFO_PROP_ID
,
info
,
&
size
);
if
(
ret
)
...
...
@@ -1003,7 +1003,7 @@ BOOL WINAPI CryptAcquireCertificatePrivateKey(PCCERT_CONTEXT pCert,
}
}
}
HeapFree
(
GetProcessHeap
(),
0
,
info
);
CryptMemFree
(
info
);
if
(
cert_in_store
)
CertFreeCertificateContext
(
cert_in_store
);
return
ret
;
...
...
dlls/crypt32/chain.c
View file @
1fb28509
...
...
@@ -2007,7 +2007,7 @@ static PCCERT_CONTEXT CRYPT_FindIssuer(const CertificateChainEngine *engine, con
if
(
!
res
)
return
NULL
;
urls
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
urls
=
CryptMemAlloc
(
size
);
if
(
!
urls
)
return
NULL
;
...
...
@@ -2045,7 +2045,7 @@ static PCCERT_CONTEXT CRYPT_FindIssuer(const CertificateChainEngine *engine, con
}
}
HeapFree
(
GetProcessHeap
(),
0
,
urls
);
CryptMemFree
(
urls
);
return
issuer
;
}
...
...
dlls/crypt32/msg.c
View file @
1fb28509
...
...
@@ -1666,12 +1666,12 @@ static BOOL CRYPT_ExportEncryptedKey(CMSG_CONTENT_ENCRYPT_INFO *info, DWORD i,
static
LPVOID
WINAPI
mem_alloc
(
size_t
size
)
{
return
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
return
CryptMemAlloc
(
size
);
}
static
VOID
WINAPI
mem_free
(
LPVOID
pv
)
{
HeapFree
(
GetProcessHeap
(),
0
,
pv
);
CryptMemFree
(
pv
);
}
...
...
dlls/crypt32/pfx.c
View file @
1fb28509
...
...
@@ -17,7 +17,6 @@
*/
#include <stdarg.h>
#include <stdlib.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
...
...
@@ -28,7 +27,6 @@
#include "crypt32_private.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
crypt
);
...
...
@@ -55,17 +53,17 @@ static HCRYPTPROV import_key( cert_store_data_t data, DWORD flags )
}
}
params
.
buf
=
key
=
ma
lloc
(
size
);
params
.
buf
=
key
=
CryptMemA
lloc
(
size
);
if
(
CRYPT32_CALL
(
import_store_key
,
&
params
)
||
!
CryptImportKey
(
prov
,
key
,
size
,
0
,
flags
&
CRYPT_EXPORTABLE
,
&
cryptkey
))
{
WARN
(
"CryptImportKey failed %08lx
\n
"
,
GetLastError
()
);
CryptReleaseContext
(
prov
,
0
);
f
ree
(
key
);
CryptMemF
ree
(
key
);
return
0
;
}
CryptDestroyKey
(
cryptkey
);
f
ree
(
key
);
CryptMemF
ree
(
key
);
return
prov
;
}
...
...
@@ -177,10 +175,10 @@ HCERTSTORE WINAPI PFXImportCertStore( CRYPT_DATA_BLOB *pfx, const WCHAR *passwor
struct
import_store_cert_params
import_params
=
{
data
,
i
,
NULL
,
&
size
};
if
(
CRYPT32_CALL
(
import_store_cert
,
&
import_params
)
!=
STATUS_BUFFER_TOO_SMALL
)
break
;
import_params
.
buf
=
cert
=
ma
lloc
(
size
);
import_params
.
buf
=
cert
=
CryptMemA
lloc
(
size
);
if
(
!
CRYPT32_CALL
(
import_store_cert
,
&
import_params
))
ctx
=
CertCreateContext
(
CERT_STORE_CERTIFICATE_CONTEXT
,
X509_ASN_ENCODING
,
cert
,
size
,
0
,
NULL
);
f
ree
(
cert
);
CryptMemF
ree
(
cert
);
if
(
!
ctx
)
{
WARN
(
"CertCreateContext failed %08lx
\n
"
,
GetLastError
()
);
...
...
dlls/crypt32/rootstore.c
View file @
1fb28509
...
...
@@ -18,7 +18,6 @@
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
...
...
@@ -622,19 +621,19 @@ static void read_trusted_roots_from_known_locations(HCERTSTORE store)
if
(
from
)
{
params
.
buffer
=
ma
lloc
(
params
.
size
);
params
.
buffer
=
CryptMemA
lloc
(
params
.
size
);
while
(
!
CRYPT32_CALL
(
enum_root_certs
,
&
params
))
{
if
(
needed
>
params
.
size
)
{
f
ree
(
params
.
buffer
);
params
.
buffer
=
ma
lloc
(
needed
);
CryptMemF
ree
(
params
.
buffer
);
params
.
buffer
=
CryptMemA
lloc
(
needed
);
params
.
size
=
needed
;
}
else
CertAddEncodedCertificateToStore
(
from
,
X509_ASN_ENCODING
,
params
.
buffer
,
needed
,
CERT_STORE_ADD_NEW
,
NULL
);
}
f
ree
(
params
.
buffer
);
CryptMemF
ree
(
params
.
buffer
);
check_and_store_certs
(
from
,
store
);
}
CertCloseStore
(
from
,
0
);
...
...
dlls/crypt32/serialize.c
View file @
1fb28509
...
...
@@ -72,7 +72,7 @@ static DWORD serialize_KeyProvInfoProperty(const CRYPT_KEY_PROV_INFO *info, stru
if
(
!
ret
)
return
size
;
store
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
store
=
CryptMemAlloc
(
size
);
if
(
!
store
)
return
0
;
param
=
(
struct
store_CRYPT_KEY_PROV_PARAM
*
)(
store
+
1
);
...
...
@@ -331,7 +331,7 @@ static DWORD read_serialized_KeyProvInfoProperty(const struct store_CRYPT_KEY_PR
for
(
i
=
0
;
i
<
store
->
cProvParam
;
i
++
)
size
+=
sizeof
(
CRYPT_KEY_PROV_PARAM
)
+
param
[
i
].
cbData
;
info
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
info
=
CryptMemAlloc
(
size
);
if
(
!
info
)
{
SetLastError
(
ERROR_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