Fixing memory leak in FakeTransportController.

Introduced by: https://codereview.webrtc.org/2641633002/
Only occurs with test code.

BUG=webrtc:6972
TBR=pthatcher@webrtc.org

Review-Url: https://codereview.webrtc.org/2648093002
Cr-Original-Commit-Position: refs/heads/master@{#16200}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 3e4faae0edeb2b30e899712f92217d2aa5cd6ff2
diff --git a/p2p/base/faketransportcontroller.h b/p2p/base/faketransportcontroller.h
index d97b4b6..76ed370 100644
--- a/p2p/base/faketransportcontroller.h
+++ b/p2p/base/faketransportcontroller.h
@@ -613,24 +613,28 @@
   // exchange of ICE candidates.
   void Connect(FakeTransportController* dest) {
     for (const std::string& transport_name : transport_names_for_testing()) {
+      std::unique_ptr<rtc::SSLFingerprint> local_fingerprint;
+      std::unique_ptr<rtc::SSLFingerprint> remote_fingerprint;
+      if (certificate_for_testing()) {
+        local_fingerprint.reset(rtc::SSLFingerprint::CreateFromCertificate(
+            certificate_for_testing()));
+      }
+      if (dest->certificate_for_testing()) {
+        remote_fingerprint.reset(rtc::SSLFingerprint::CreateFromCertificate(
+            dest->certificate_for_testing()));
+      }
       TransportDescription local_desc(
           std::vector<std::string>(),
           rtc::CreateRandomString(cricket::ICE_UFRAG_LENGTH),
           rtc::CreateRandomString(cricket::ICE_PWD_LENGTH),
           cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_NONE,
-          certificate_for_testing()
-              ? rtc::SSLFingerprint::CreateFromCertificate(
-                    certificate_for_testing())
-              : nullptr);
+          local_fingerprint.get());
       TransportDescription remote_desc(
           std::vector<std::string>(),
           rtc::CreateRandomString(cricket::ICE_UFRAG_LENGTH),
           rtc::CreateRandomString(cricket::ICE_PWD_LENGTH),
           cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_NONE,
-          dest->certificate_for_testing()
-              ? rtc::SSLFingerprint::CreateFromCertificate(
-                    dest->certificate_for_testing())
-              : nullptr);
+          remote_fingerprint.get());
       std::string err;
       SetLocalTransportDescription(transport_name, local_desc,
                                    cricket::CA_OFFER, &err);