From f0b351c2e0fa50eeb16ef4aa7eeff8434b62b844 Mon Sep 17 00:00:00 2001 From: bunnie Date: Sun, 16 Jul 2023 17:58:40 +0800 Subject: [PATCH] suggested method to preserve intent of `drop` to fix error However, I didn't write this library (and I don't have a test suite for it), so I'm not quite sure if this preserves the invariants on the fd_mapping() structure. Needs @xobs' review. --- services/pddb/src/libstd/mod.rs | 1 - services/pddb/src/main.rs | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/services/pddb/src/libstd/mod.rs b/services/pddb/src/libstd/mod.rs index efa664143..39629f14a 100644 --- a/services/pddb/src/libstd/mod.rs +++ b/services/pddb/src/libstd/mod.rs @@ -517,7 +517,6 @@ pub(crate) fn close_key( return Err(crate::PddbRetcode::UnexpectedEof); } }; - core::mem::drop(file); // If this SID is unused, close the connection. if let Some(cid) = conn { diff --git a/services/pddb/src/main.rs b/services/pddb/src/main.rs index bb7341a71..26e0c3606 100644 --- a/services/pddb/src/main.rs +++ b/services/pddb/src/main.rs @@ -1096,6 +1096,7 @@ fn wrapped_main() -> ! { if let Err(e) = result { xous::return_scalar(msg.sender, e as usize) } else { + fd_mapping.remove(&msg.sender.pid()); xous::return_scalar2(msg.sender, 0, 0) }.ok(); }