ITADN

nostrdb review findings

#89Closedalltheseas 创建于 2025-10-20
A
alltheseascommented
``` src/ndb.rs:39 – The drop path for NdbRef casts rust_cb_ctx to Box<dyn FnMut()>, but the pointer actually came from Box<dyn FnMut(u64)> in Config::set_sub_callback. Dropping it through the wrong trait-object type is undefined behaviour (bad vtable). Reconstruct it with the original signature before the drop. - src/note.rs:355-374 – If ndb_builder_init returns false, the freshly malloc’d buffer is leaked because the code immediately returns None. Free the buffer (and consider logging) before bailing out. - src/note.rs:342-383 – NoteBuilder never frees the heap buffer it allocates in with_bufsize/new. Each builder leaks ~1 MiB on drop. Implement Drop to release self.buffer (or wrap it in a smart pointer) so short-lived builders don’t steadily exhaust memory. ```
关闭于 2025-10-20 2 条评论