Fix use-after-free in SimpleSessionNotifierTest

gfe-relnote: n/a (test-only change)
PiperOrigin-RevId: 262469488
Change-Id: Icc3cdd089ae67c6c3ff73bc13c6836c51f721360
diff --git a/quic/test_tools/simple_session_notifier_test.cc b/quic/test_tools/simple_session_notifier_test.cc
index 8b931fe..63da639 100644
--- a/quic/test_tools/simple_session_notifier_test.cc
+++ b/quic/test_tools/simple_session_notifier_test.cc
@@ -251,8 +251,10 @@
       .WillOnce(Invoke(&connection_,
                        &MockQuicConnection::QuicConnection_SendCryptoData));
   EXPECT_CALL(connection_, CloseConnection(QUIC_PACKET_WRITE_ERROR, _, _));
-  producer.SaveCryptoData(ENCRYPTION_INITIAL, 0, std::string(1024, 'a'));
-  producer.SaveCryptoData(ENCRYPTION_INITIAL, 500, std::string(524, 'a'));
+  std::string crypto_data1(1024, 'a');
+  producer.SaveCryptoData(ENCRYPTION_INITIAL, 0, crypto_data1);
+  std::string crypto_data2(524, 'a');
+  producer.SaveCryptoData(ENCRYPTION_INITIAL, 500, crypto_data2);
   notifier_.WriteCryptoData(ENCRYPTION_INITIAL, 1024, 0);
   // Send crypto data [1024, 2048) in ENCRYPTION_ZERO_RTT.
   connection_.SetDefaultEncryptionLevel(ENCRYPTION_ZERO_RTT);
@@ -261,7 +263,8 @@
   EXPECT_CALL(connection_, SendCryptoData(ENCRYPTION_ZERO_RTT, 1024, 0))
       .WillOnce(Invoke(&connection_,
                        &MockQuicConnection::QuicConnection_SendCryptoData));
-  producer.SaveCryptoData(ENCRYPTION_ZERO_RTT, 0, std::string(1024, 'a'));
+  std::string crypto_data3(1024, 'a');
+  producer.SaveCryptoData(ENCRYPTION_ZERO_RTT, 0, crypto_data3);
   notifier_.WriteCryptoData(ENCRYPTION_ZERO_RTT, 1024, 0);
   // Send stream 3 [0, 1024) and connection is blocked.
   EXPECT_CALL(connection_, SendStreamData(3, 1024, 0, FIN))