Skip to content

Commit

Permalink
Fixed possible memory leak.
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-richard committed Sep 5, 2018
1 parent b55bdc9 commit 3bd864e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/vmime/net/tls/gnutls/TLSSocket_GnuTLS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3bd864e

Please sign in to comment.