Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b4d908fd authored by Sai Kumar Sanagavarapu's avatar Sai Kumar Sanagavarapu Committed by Linux Build Service Account
Browse files

CameraJNI: Fix memory leak in stop recording.

Issue:
Due to race conditions, if a recording frame callback is received
after a proxy listener is set to NULL, the callback is forwarded
to JNIContext which does nothing. This will lead to buffer leak
in metadata mode because fd would have been duped already.

Fix:
Release recording frame from JNIContext.

Bug: 30299751
CRs-Fixed: 1040448
Change-Id: I315ec3124014c6309d68fdc1be1e18091a84e154
parent 6b336ff5
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -371,9 +371,10 @@ void JNICameraContext::postDataTimestamp(nsecs_t timestamp, int32_t msgType, con
    postData(msgType, dataPtr, NULL);
}

void JNICameraContext::postRecordingFrameHandleTimestamp(nsecs_t, native_handle_t*) {
void JNICameraContext::postRecordingFrameHandleTimestamp(nsecs_t, native_handle_t* handle) {
    // This is not needed at app layer. This should not be called because JNICameraContext cannot
    // start video recording.
    mCamera->releaseRecordingFrameHandle(handle);
}

void JNICameraContext::postMetadata(JNIEnv *env, int32_t msgType, camera_frame_metadata_t *metadata)