From ecd3296f1eb58e250b46b28761b13f88dcb025f6 Mon Sep 17 00:00:00 2001 From: Jasmine Chen Date: Thu, 25 Feb 2021 21:57:31 +0800 Subject: [PATCH] Camera: Fix double-free in removeCamera When a camera is removed, |hidlMetadata| takes over ownership of |metadata|. Therefore, we should not free |metadata| again. Bug: 180014486 Test: Remove an external camera, and no crashes were observed. Marged-In: I85246067f8753911cbcb58af24a46f12962226f3 Change-Id: I85246067f8753911cbcb58af24a46f12962226f3 (cherry picked from commit f36a439e3a97315a9f0a8661ea77aff61fb79c82) (cherry picked from commit 682abf403969efcbc8072a26f687560ad9def69a) --- camera/common/1.0/default/CameraModule.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/camera/common/1.0/default/CameraModule.cpp b/camera/common/1.0/default/CameraModule.cpp index 27e74f1480..16fb85cc64 100644 --- a/camera/common/1.0/default/CameraModule.cpp +++ b/camera/common/1.0/default/CameraModule.cpp @@ -549,7 +549,6 @@ void CameraModule::removeCamera(int cameraId) { } } } - free_camera_metadata(metadata); } mCameraInfoMap.removeItem(cameraId);