From 0a870c2f7e00ee4d6f54709adefc01015ea93f4c Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Mon, 26 Oct 2015 15:45:39 -0400 Subject: [PATCH] Correctly free SSL_SESSIONs in ssl_test. That was silly. Change-Id: I375c04f725cbb75f9e04fce386e20c4de5e7ae0c Reviewed-on: https://boringssl-review.googlesource.com/6352 Reviewed-by: Adam Langley --- ssl/ssl_test.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ssl/ssl_test.cc b/ssl/ssl_test.cc index a5d8beaf..345e5dc4 100644 --- a/ssl/ssl_test.cc +++ b/ssl/ssl_test.cc @@ -877,19 +877,19 @@ static ScopedSSL_SESSION CreateTestSession(uint32_t number) { // TODO(davidben): Switch this to a |std::vector| once we can // rely on a move-aware |std::vector|. -template -class ScopedVector { +class ScopedSessionVector { public: - explicit ScopedVector(std::vector *v) : v_(v) {} + explicit ScopedSessionVector(std::vector *sessions) + : sessions_(sessions) {} - ~ScopedVector() { - for (T *t : *v_) { - delete t; + ~ScopedSessionVector() { + for (SSL_SESSION *session : *sessions_) { + SSL_SESSION_free(session); } } private: - std::vector *const v_; + std::vector *const sessions_; }; // Test that the internal session cache behaves as expected. @@ -901,7 +901,7 @@ static bool TestInternalSessionCache() { // Prepare 10 test sessions. std::vector sessions; - ScopedVector cleanup(&sessions); + ScopedSessionVector cleanup(&sessions); for (int i = 0; i < 10; i++) { ScopedSSL_SESSION session = CreateTestSession(i); if (!session) {