flutter_zxing
flutter_zxing copied to clipboard
ffi: fix use-after-free
The ImageView borrows from the image buffer in DecodeBarcodeParams -- the newly refactored code frees it too early.
To help prevent some of these issues in the future, we'll be a bit clearer that DecodeBarcodeParams owns the buffer and actually free it in the destructor. Same with EncodeBarcodeParams and contents.
I've also disabled the copy/move constructors so we don't accidentally double free or free a nullptr.