Jinoh Kang (@iamahuman) commented about server/mapping.c:
- {
shared->obj.id = ++session.last_object_id;
- }
- SHARED_WRITE_END;
- session.next_object_index = index + 1;
- return index;
+}
+void free_shared_object( int index ) +{
- if (index < 0) return;
- SHARED_WRITE_BEGIN( &session.shared->objects[index], session_obj_t )
- {
shared->obj.id = 0;
We're releasing the object unscrubbed. A future `alloc_shared_object()` call will return uninitialized memory, with leftover contents from previous allocation.[^1]
```suggestion:-0+0 memset( (char *)shared + offsetof(session_obj_t, obj.id), 0, sizeof(*shared) - offsetof(session_obj_t, obj.id) ); ```
[^1]: This means that e.g., queues will reuse memory from inputs, once we introduce other kinds of shared objects.