Fix warning: Potential leak of memory pointed to by 'device'
This fixes the waring: Potential leak of memory pointed to by 'device'
Change-Id: I7e80c36ef4a66bb0e9febef7941c87eb4a083110
Test: The warning is gone.
diff --git a/camera/ndk/impl/ACameraManager.cpp b/camera/ndk/impl/ACameraManager.cpp
index 35555ff..1609da1 100644
--- a/camera/ndk/impl/ACameraManager.cpp
+++ b/camera/ndk/impl/ACameraManager.cpp
@@ -475,6 +475,7 @@
sp<hardware::ICameraService> cs = CameraManagerGlobal::getInstance().getCameraService();
if (cs == nullptr) {
ALOGE("%s: Cannot reach camera service!", __FUNCTION__);
+ delete device;
return ACAMERA_ERROR_CAMERA_DISCONNECTED;
}