From ec403885d4284d29651e3d35d802b640b9886580 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Tue, 11 Feb 2020 20:23:57 +0100 Subject: [PATCH] Reset os_ipc_channels correctly on error --- src/ipc.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ipc.rs b/src/ipc.rs index 34908b439..bf4051fd7 100644 --- a/src/ipc.rs +++ b/src/ipc.rs @@ -293,13 +293,14 @@ impl IpcSender where T: Serialize { let os_ipc_shared_memory_regions; let os_ipc_channels; { - bincode::serialize_into(&mut bytes, &data)?; + let rv = bincode::serialize_into(&mut bytes, &data); os_ipc_channels = mem::replace(&mut *os_ipc_channels_for_serialization.borrow_mut(), old_os_ipc_channels); os_ipc_shared_memory_regions = mem::replace( &mut *os_ipc_shared_memory_regions_for_serialization.borrow_mut(), old_os_ipc_shared_memory_regions); + rv?; }; Ok(self.os_sender.send(&bytes[..], os_ipc_channels, os_ipc_shared_memory_regions)?) })