QSslSocket: call to ERR_free_strings to free loaded error strings

Since we are calling q_SSL_load_error_strings to load error strings
we should call ERR_free_strings to free the memory again.

Task-number: QTBUG-15732
Change-Id: Ie41291bb0e1434f82025378edfca51930712a8aa
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Martin Petersson 2012-03-30 14:38:10 +02:00 committed by Qt by Nokia
parent fb8cd418fb
commit a8a5b38b00
3 changed files with 5 additions and 0 deletions

View File

@ -539,6 +539,7 @@ void QSslSocketPrivate::deinitialize()
{ {
q_CRYPTO_set_id_callback(0); q_CRYPTO_set_id_callback(0);
q_CRYPTO_set_locking_callback(0); q_CRYPTO_set_locking_callback(0);
q_ERR_free_strings();
} }
/*! /*!
@ -560,6 +561,7 @@ bool QSslSocketPrivate::ensureLibraryLoaded()
// Check if the library itself needs to be initialized. // Check if the library itself needs to be initialized.
QMutexLocker locker(openssl_locks()->initLock()); QMutexLocker locker(openssl_locks()->initLock());
if (!s_libraryLoaded) { if (!s_libraryLoaded) {
s_libraryLoaded = true; s_libraryLoaded = true;

View File

@ -125,6 +125,7 @@ DEFINEFUNC3(X509 *, d2i_X509, X509 **a, a, const unsigned char **b, b, long c, c
#endif #endif
DEFINEFUNC2(char *, ERR_error_string, unsigned long a, a, char *b, b, return 0, return) DEFINEFUNC2(char *, ERR_error_string, unsigned long a, a, char *b, b, return 0, return)
DEFINEFUNC(unsigned long, ERR_get_error, DUMMYARG, DUMMYARG, return 0, return) DEFINEFUNC(unsigned long, ERR_get_error, DUMMYARG, DUMMYARG, return 0, return)
DEFINEFUNC(void, ERR_free_strings, void, DUMMYARG, return, DUMMYARG)
DEFINEFUNC(const EVP_CIPHER *, EVP_des_ede3_cbc, DUMMYARG, DUMMYARG, return 0, return) DEFINEFUNC(const EVP_CIPHER *, EVP_des_ede3_cbc, DUMMYARG, DUMMYARG, return 0, return)
DEFINEFUNC3(int, EVP_PKEY_assign, EVP_PKEY *a, a, int b, b, char *c, c, return -1, return) DEFINEFUNC3(int, EVP_PKEY_assign, EVP_PKEY *a, a, int b, b, char *c, c, return -1, return)
DEFINEFUNC2(int, EVP_PKEY_set1_RSA, EVP_PKEY *a, a, RSA *b, b, return -1, return) DEFINEFUNC2(int, EVP_PKEY_set1_RSA, EVP_PKEY *a, a, RSA *b, b, return -1, return)
@ -560,6 +561,7 @@ bool q_resolveOpenSslSymbols()
RESOLVEFUNC(DSA_free) RESOLVEFUNC(DSA_free)
RESOLVEFUNC(ERR_error_string) RESOLVEFUNC(ERR_error_string)
RESOLVEFUNC(ERR_get_error) RESOLVEFUNC(ERR_get_error)
RESOLVEFUNC(ERR_free_strings)
RESOLVEFUNC(EVP_des_ede3_cbc) RESOLVEFUNC(EVP_des_ede3_cbc)
RESOLVEFUNC(EVP_PKEY_assign) RESOLVEFUNC(EVP_PKEY_assign)
RESOLVEFUNC(EVP_PKEY_set1_RSA) RESOLVEFUNC(EVP_PKEY_set1_RSA)

View File

@ -226,6 +226,7 @@ X509 *q_d2i_X509(X509 **a, unsigned char **b, long c);
#endif #endif
char *q_ERR_error_string(unsigned long a, char *b); char *q_ERR_error_string(unsigned long a, char *b);
unsigned long q_ERR_get_error(); unsigned long q_ERR_get_error();
void q_ERR_free_strings();
const EVP_CIPHER *q_EVP_des_ede3_cbc(); const EVP_CIPHER *q_EVP_des_ede3_cbc();
int q_EVP_PKEY_assign(EVP_PKEY *a, int b, char *c); int q_EVP_PKEY_assign(EVP_PKEY *a, int b, char *c);
Q_AUTOTEST_EXPORT int q_EVP_PKEY_set1_RSA(EVP_PKEY *a, RSA *b); Q_AUTOTEST_EXPORT int q_EVP_PKEY_set1_RSA(EVP_PKEY *a, RSA *b);