Release locked buffer when it fails to acquire graphics buffer

The JNI buffer in ImageReader_imageSetup is not released when
it fails to acquire graphics buffer. After all JNI buffers are
exhausted, ACQUIRE_MAX_IMAGES will be returned and leads to
error. The JNI buffer should be released when it fails to acquire
graphics buffer.

Change-Id: I3319a58ac44e36c8593b404672a685c4b589a735
This commit is contained in:
lina.x.pi
2014-01-27 10:31:44 +08:00
committed by Takeshi Aimi
parent 1ff4293e33
commit 334778981d

View File

@@ -707,6 +707,7 @@ static jint ImageReader_imageSetup(JNIEnv* env, jobject thiz,
}
status_t res = consumer->lockNextBuffer(buffer);
if (res != NO_ERROR) {
ctx->returnLockedBuffer(buffer);
if (res != BAD_VALUE /*no buffers*/) {
if (res == NOT_ENOUGH_DATA) {
return ACQUIRE_MAX_IMAGES;