diff options
| author | Vincent Richard <[email protected]> | 2018-09-06 00:05:13 +0200 |
|---|---|---|
| committer | Vincent Richard <[email protected]> | 2018-09-06 00:05:13 +0200 |
| commit | 3bd864efc21ca6aa8f67521b4ef6f6410d66fba2 (patch) | |
| tree | 3f9a11a1782117c8a75d84d871c96022b10b7ed3 /src | |
| parent | Code style and clarity. (diff) | |
| download | vmime-3bd864efc21ca6aa8f67521b4ef6f6410d66fba2.tar.gz vmime-3bd864efc21ca6aa8f67521b4ef6f6410d66fba2.zip | |
Fixed possible memory leak.
Diffstat (limited to 'src')
| -rw-r--r-- | src/vmime/net/tls/gnutls/TLSSocket_GnuTLS.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/vmime/net/tls/gnutls/TLSSocket_GnuTLS.cpp b/src/vmime/net/tls/gnutls/TLSSocket_GnuTLS.cpp index 93f1b763..73d52231 100644 --- a/src/vmime/net/tls/gnutls/TLSSocket_GnuTLS.cpp +++ b/src/vmime/net/tls/gnutls/TLSSocket_GnuTLS.cpp @@ -468,6 +468,11 @@ shared_ptr <security::cert::certificateChain> TLSSocket_GnuTLS::getPeerCertifica int res = gnutls_x509_crt_import(x509Certs[i], rawData + i, GNUTLS_X509_FMT_DER); if (res < 0) { + + for (unsigned int j = 0 ; j <= i ; ++j) { + gnutls_x509_crt_deinit(x509Certs[j]); + } + // XXX more fine-grained error reporting? delete [] x509Certs; return null; |
