Internal QUICHE change

PiperOrigin-RevId: 344255387
Change-Id: I02cd0dd29159e1f92bdfecbf69c5edc68102dae0
diff --git a/quic/core/quic_sent_packet_manager.cc b/quic/core/quic_sent_packet_manager.cc
index fba8b67..21a9626 100644
--- a/quic/core/quic_sent_packet_manager.cc
+++ b/quic/core/quic_sent_packet_manager.cc
@@ -671,7 +671,17 @@
     // applications may want to use higher priority stream data for bandwidth
     // probing, and some applications want to consider RTO is an indication of
     // loss, etc.
-    unacked_packets_.RetransmitFrames(*transmission_info, transmission_type);
+    // transmission_info owning these frames may be deallocated after each
+    // retransimission. Make a copy of retransmissible frames to prevent the
+    // invalidation.
+    if (unacked_packets_.use_circular_deque()) {
+      unacked_packets_.RetransmitFrames(
+          QuicFrames(transmission_info->retransmittable_frames),
+          transmission_type);
+    } else {
+      unacked_packets_.RetransmitFrames(
+          transmission_info->retransmittable_frames, transmission_type);
+    }
     return;
   }