@@ -534,6 +534,8 @@ int CameraDevice::open(const hw_module_t *hardwareModule)
void CameraDevice::close()
{
+ allocator_.freeAll();
+
camera_->stop();
camera_->release();
@@ -1181,12 +1183,13 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)
}
/*
- * Clear and remove any existing configuration from previous calls, and
- * ensure the required entries are available without further
- * reallocation.
+ * Clear and remove any existing configuration and memory allocated from
+ * previous calls, and ensure the required entries are available without
+ * further reallocation.
*/
streams_.clear();
streams_.reserve(stream_list->num_streams);
+ allocator_.freeAll();
/* First handle all non-MJPEG streams. */
camera3_stream_t *jpegStream = nullptr;