mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-09-27 17:58:47 +00:00
The core allocates every chat_* response with malloc and passes ownership to the caller, as iOS does in API.swift. Both JNI bindings copied the bytes into a Java string and dropped the pointer, so every command, event and file read leaked its whole response into the C allocator - invisible to both the JVM and the Haskell heap profiler. Desktop frees in decode_to_utf8_string, the funnel every entry point already goes through. Android has no such funnel because NewStringUTF is called inline, so decode_and_free is added and the call sites routed through it. chatReadFile frees directly on both.