diff options
author | Chien-Yu Chen <cychen@google.com> | 2014-11-12 23:40:00 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-11-12 23:40:00 +0000 |
commit | 7deab61ade08ffd0971323594ded4937e2db8265 (patch) | |
tree | b68abf854a5db70318ceab12ae9c5fbf39cf7426 /services/camera | |
parent | cea67364cee2c8e2e9baae86276cdeb0e13c8c0d (diff) | |
parent | 06ce4cf5e3f8715635bc1913dcbb1d32fbd510a7 (diff) | |
download | frameworks_av-7deab61ade08ffd0971323594ded4937e2db8265.zip frameworks_av-7deab61ade08ffd0971323594ded4937e2db8265.tar.gz frameworks_av-7deab61ade08ffd0971323594ded4937e2db8265.tar.bz2 |
am 06ce4cf5: Merge "Camera2Device: fix camera metadata leaks" into lmp-mr1-dev automerge: 7c77c75
* commit '06ce4cf5e3f8715635bc1913dcbb1d32fbd510a7':
Camera2Device: fix camera metadata leaks
Diffstat (limited to 'services/camera')
-rw-r--r-- | services/camera/libcameraservice/device2/Camera2Device.cpp | 16 | ||||
-rw-r--r-- | services/camera/libcameraservice/device2/Camera2Device.h | 4 |
2 files changed, 5 insertions, 15 deletions
diff --git a/services/camera/libcameraservice/device2/Camera2Device.cpp b/services/camera/libcameraservice/device2/Camera2Device.cpp index 8caadd6..d1158d6 100644 --- a/services/camera/libcameraservice/device2/Camera2Device.cpp +++ b/services/camera/libcameraservice/device2/Camera2Device.cpp @@ -793,11 +793,6 @@ status_t Camera2Device::MetadataQueue::setStreamSlot(camera_metadata_t *buf) mStreamSlotCount = 0; return OK; } - camera_metadata_t *buf2 = clone_camera_metadata(buf); - if (!buf2) { - ALOGE("%s: Unable to clone metadata buffer!", __FUNCTION__); - return NO_MEMORY; - } if (mStreamSlotCount > 1) { List<camera_metadata_t*>::iterator deleter = ++mStreamSlot.begin(); @@ -806,9 +801,9 @@ status_t Camera2Device::MetadataQueue::setStreamSlot(camera_metadata_t *buf) } if (mStreamSlotCount == 1) { free_camera_metadata( *(mStreamSlot.begin()) ); - *(mStreamSlot.begin()) = buf2; + *(mStreamSlot.begin()) = buf; } else { - mStreamSlot.push_front(buf2); + mStreamSlot.push_front(buf); mStreamSlotCount = 1; } return signalConsumerLocked(); @@ -827,12 +822,7 @@ status_t Camera2Device::MetadataQueue::setStreamSlot( mStreamSlotCount = 0; for (List<camera_metadata_t*>::const_iterator r = bufs.begin(); r != bufs.end(); r++) { - camera_metadata_t *r2 = clone_camera_metadata(*r); - if (!r2) { - ALOGE("%s: Unable to clone metadata buffer!", __FUNCTION__); - return NO_MEMORY; - } - mStreamSlot.push_back(r2); + mStreamSlot.push_back(*r); mStreamSlotCount++; } return signalConsumerLocked(); diff --git a/services/camera/libcameraservice/device2/Camera2Device.h b/services/camera/libcameraservice/device2/Camera2Device.h index 2a3f1d9..4def8ae 100644 --- a/services/camera/libcameraservice/device2/Camera2Device.h +++ b/services/camera/libcameraservice/device2/Camera2Device.h @@ -124,8 +124,8 @@ class Camera2Device: public CameraDeviceBase { // Set repeating buffer(s); if the queue is empty on a dequeue call, the // queue copies the contents of the stream slot into the queue, and then - // dequeues the first new entry. The metadata buffers passed in are - // copied. + // dequeues the first new entry. The methods take the ownership of the + // metadata buffers passed in. status_t setStreamSlot(camera_metadata_t *buf); status_t setStreamSlot(const List<camera_metadata_t*> &bufs); |