From d9b06b73b2fb4f329a5b079f94bf72156f5611d2 Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Thu, 14 Jul 2022 14:31:33 +0900 Subject: Fix coverity issue - Resource Leak [Version] 0.4.84 [Issue Type] Coverity Change-Id: I9acd47d700065f466640f0e8c37a92215e3561e1 Signed-off-by: Jeongmo Yang --- packaging/capi-media-camera.spec | 2 +- src/camera.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec index a0a02fb..28848ce 100644 --- a/packaging/capi-media-camera.spec +++ b/packaging/capi-media-camera.spec @@ -1,6 +1,6 @@ Name: capi-media-camera Summary: A Camera API -Version: 0.4.83 +Version: 0.4.84 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/camera.c b/src/camera.c index 4dbf71a..000304b 100644 --- a/src/camera.c +++ b/src/camera.c @@ -6451,7 +6451,7 @@ int camera_device_manager_initialize(camera_device_manager_h *manager) unsigned int i = 0; int ret = CAMERA_ERROR_NONE; void *dl_handle = NULL; - camera_device_manager *new_manager = g_new0(camera_device_manager, 1); + camera_device_manager *new_manager = NULL; cdm_symbol_table sym_table[] = { {(void **)&new_manager->initialize, "cdm_initialize"}, {(void **)&new_manager->deinitialize, "cdm_deinitialize"}, @@ -6462,6 +6462,8 @@ int camera_device_manager_initialize(camera_device_manager_h *manager) CAMERA_CHECK_DEVICE_MANAGER; + new_manager = g_new0(camera_device_manager, 1); + if (!manager) { CAM_LOG_ERROR("NULL manager"); ret = CAMERA_ERROR_INVALID_PARAMETER; -- cgit v1.2.3