summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaul Metsma <raul@innovaatik.ee>2009-08-31 09:20:52 (GMT)
committerPeter Hartmann <peter.hartmann@trolltech.com>2009-08-31 09:20:52 (GMT)
commitf6863745919c3ddf66734ca2045a9b5086835af1 (patch)
tree371b1c1bd75192687aa943b1ed02ec2492d72fe0
parent7f1d1eaeb1dbe7b0951e4b3c47b27c7dc95eb7c1 (diff)
downloadQt-f6863745919c3ddf66734ca2045a9b5086835af1.zip
Qt-f6863745919c3ddf66734ca2045a9b5086835af1.tar.gz
Qt-f6863745919c3ddf66734ca2045a9b5086835af1.tar.bz2
Fix QSslCertificate::alternateSubjectNames() memory leak
Task-number: 258964 Merge-request: 1382 Reviewed-by: Peter Hartmann <peter.hartmann@trolltech.com>
-rw-r--r--src/network/ssl/qsslcertificate.cpp2
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols.cpp2
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols_p.h1
3 files changed, 4 insertions, 1 deletions
diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp
index 8d855b1..7b5653d 100644
--- a/src/network/ssl/qsslcertificate.cpp
+++ b/src/network/ssl/qsslcertificate.cpp
@@ -387,7 +387,7 @@ QMultiMap<QSsl::AlternateNameEntryType, QString> QSslCertificate::alternateSubje
else if (genName->type == GEN_EMAIL)
result.insert(QSsl::EmailEntry, altName);
}
- q_sk_free((STACK*)altNames);
+ q_sk_pop_free((STACK*)altNames, q_sk_free);
}
return result;
diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp
index be5c93c..91cef69 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols.cpp
+++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp
@@ -144,6 +144,7 @@ DEFINEFUNC(int, RAND_status, void, DUMMYARG, return -1, return)
DEFINEFUNC(void, RSA_free, RSA *a, a, return, DUMMYARG)
DEFINEFUNC(void, sk_free, STACK *a, a, return, DUMMYARG)
DEFINEFUNC(int, sk_num, STACK *a, a, return -1, return)
+DEFINEFUNC2(void, sk_pop_free, STACK *a, a, void (*b)(STACK*), b, return, DUMMYARG)
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
DEFINEFUNC2(void *, sk_value, STACK *a, a, int b, b, return 0, return)
#else
@@ -650,6 +651,7 @@ bool q_resolveOpenSslSymbols()
RESOLVEFUNC(RSA_free)
RESOLVEFUNC(sk_free)
RESOLVEFUNC(sk_num)
+ RESOLVEFUNC(sk_pop_free)
RESOLVEFUNC(sk_value)
RESOLVEFUNC(SSL_CIPHER_description)
RESOLVEFUNC(SSL_CTX_check_private_key)
diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h
index 8c7acd7..38f92d4 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols_p.h
+++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h
@@ -256,6 +256,7 @@ int q_RAND_status();
void q_RSA_free(RSA *a);
void q_sk_free(STACK *a);
int q_sk_num(STACK *a);
+void q_sk_pop_free(STACK *a, void (*b)(STACK *));
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
void * q_sk_value(STACK *a, int b);
#else