Commit ddb67584 authored by Oleg Korshul's avatar Oleg Korshul

.

parent 38ce5586
...@@ -17,6 +17,15 @@ ...@@ -17,6 +17,15 @@
#include <openssl/evp.h> #include <openssl/evp.h>
#include <openssl/conf.h> #include <openssl/conf.h>
void BIO_FREE(BIO*& bio)
{
if (bio)
{
BIO_free(bio);
bio = NULL;
}
}
class CCertificate_openssl_private class CCertificate_openssl_private
{ {
protected: protected:
...@@ -401,7 +410,7 @@ public: ...@@ -401,7 +410,7 @@ public:
goto end; goto end;
} }
BIO_free(bio); BIO_FREE(bio);
bio = BIO_new_mem_buf((void*)pData, (int)dwDataLen); bio = BIO_new_mem_buf((void*)pData, (int)dwDataLen);
if (d2i_PrivateKey_bio(bio, &pKey)) if (d2i_PrivateKey_bio(bio, &pKey))
{ {
...@@ -415,7 +424,7 @@ public: ...@@ -415,7 +424,7 @@ public:
goto end; goto end;
} }
BIO_free(bio); BIO_FREE(bio);
bio = BIO_new_mem_buf((void*)pData, (int)dwDataLen); bio = BIO_new_mem_buf((void*)pData, (int)dwDataLen);
if (d2i_PKCS8PrivateKey_bio(bio, &pKey, NULL, (void*)pPassword)) if (d2i_PKCS8PrivateKey_bio(bio, &pKey, NULL, (void*)pPassword))
{ {
...@@ -429,7 +438,7 @@ public: ...@@ -429,7 +438,7 @@ public:
goto end; goto end;
} }
BIO_free(bio); BIO_FREE(bio);
bio = BIO_new_mem_buf((void*)pData, (int)dwDataLen); bio = BIO_new_mem_buf((void*)pData, (int)dwDataLen);
p12 = d2i_PKCS12_bio(bio, NULL); p12 = d2i_PKCS12_bio(bio, NULL);
...@@ -462,7 +471,7 @@ end: ...@@ -462,7 +471,7 @@ end:
else else
*ppKey = pKey; *ppKey = pKey;
BIO_free(bio); BIO_FREE(bio);
return nErr; return nErr;
} }
...@@ -500,7 +509,7 @@ end: ...@@ -500,7 +509,7 @@ end:
goto end; goto end;
} }
BIO_free(bio); BIO_FREE(bio);
bio = BIO_new_mem_buf((void*)pData, (int)dwDataLen); bio = BIO_new_mem_buf((void*)pData, (int)dwDataLen);
if (d2i_X509_bio(bio, &pCert)) if (d2i_X509_bio(bio, &pCert))
{ {
...@@ -514,7 +523,7 @@ end: ...@@ -514,7 +523,7 @@ end:
goto end; goto end;
} }
BIO_free(bio); BIO_FREE(bio);
bio = BIO_new_mem_buf((void*)pData, (int)dwDataLen); bio = BIO_new_mem_buf((void*)pData, (int)dwDataLen);
p12 = d2i_PKCS12_bio(bio, NULL); p12 = d2i_PKCS12_bio(bio, NULL);
...@@ -528,7 +537,7 @@ end: ...@@ -528,7 +537,7 @@ end:
sk_X509_pop_free(pCa, X509_free); sk_X509_pop_free(pCa, X509_free);
EVP_PKEY_free(pKey); EVP_PKEY_free(pKey);
PKCS12_free(p12); PKCS12_free(p12);
BIO_free(bio); BIO_FREE(bio);
nErr = OPEN_SSL_WARNING_ALL_OK; nErr = OPEN_SSL_WARNING_ALL_OK;
goto end; goto end;
} }
...@@ -548,7 +557,7 @@ end: ...@@ -548,7 +557,7 @@ end:
else else
*ppCert = pCert; *ppCert = pCert;
BIO_free(bio); BIO_FREE(bio);
return nErr; return nErr;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment