HAL3: Fix a use-after-free bug
mm_camera_buf_def_t for the source YUV of HDR+ request is wrapped in a
shared_ptr, and the memory for mm_camera_buf_def_t is deallocated after
returnYuvBufferAndEncode returns.
However, mm_camera_buf_def_t pointer is still used in the JPEG callback
later on. So we keep the mm_camera_buf_def_t struct around by keeping a
shared pointer to it.
Also fix a memory leak of input metadata mm_camera_buf_def_t.
Test: for i in {1..50}; do atest -it NativeStillCaptureTest#testStillCapture; done
Bug: 150004253
Change-Id: I67ce2db1aca20245a5c3175008f17640fe6f5390
(cherry picked from commit 0ca5ca9cd3e6a29f49646e6ba62f40f993f42ce4)
4 files changed