sony / flutter-embedded-linux

Embedded Linux embedding for Flutter
BSD 3-Clause "New" or "Revised" License
1.16k stars 123 forks source link

Does BinaryMessengerImpl leak memory? #283

Closed doesnotexist closed 1 year ago

doesnotexist commented 1 year ago

I could be mistaken but I think the comment in core_implementations.cc that assigning nullptr response_handle here is not going to free the underlying object.~~ https://github.com/sony/flutter-embedded-linux/blob/master/src/flutter/shell/platform/common/client_wrapper/core_implementations.cc#L50-L52

The typedef here is of an incomplete type _FlutterPlatformMessageResponseHandle https://github.com/sony/flutter-embedded-linux/blob/master/src/flutter/shell/platform/common/public/flutter_messenger.h#L20-L22

I believe, the complete type is defined here: https://github.com/flutter/engine/blob/main/shell/platform/embedder/embedder.cc#L1077-L1079

It is not clear to me that at runtime the assignment is correctly applying unique_ptr's = operator rather than just writing nullptr to the first bytes occupied by struct whose first field is a unique_ptr object.

doesnotexist commented 1 year ago

Closing the issue, because now I see that here is where the handle is deleted: https://github.com/flutter/engine/blob/main/shell/platform/embedder/embedder.cc#L2243