diff --git a/webrtc/base/fakesslidentity.h b/webrtc/base/fakesslidentity.h index 717cb6c3b..71a42d545 100644 --- a/webrtc/base/fakesslidentity.h +++ b/webrtc/base/fakesslidentity.h @@ -65,6 +65,7 @@ class FakeSSLCertificate : public rtc::SSLCertificate { std::vector new_certs(certs_.size()); std::transform(certs_.begin(), certs_.end(), new_certs.begin(), DupCert); *chain = new SSLCertChain(new_certs); + std::for_each(new_certs.begin(), new_certs.end(), DeleteCert); return true; } @@ -72,6 +73,7 @@ class FakeSSLCertificate : public rtc::SSLCertificate { static FakeSSLCertificate* DupCert(FakeSSLCertificate cert) { return cert.GetReference(); } + static void DeleteCert(SSLCertificate* cert) { delete cert; } std::string data_; std::vector certs_; std::string digest_algorithm_;