From: Hyuntae Kim Date: Mon, 8 Jun 2020 05:19:42 +0000 (+0900) Subject: Fix resource manager memory leak issue X-Git-Tag: submit/tizen/20200611.081755^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d3eddffe71dfe33f27891355c8ff2a28ddfc2069;p=platform%2Fcore%2Fmultimedia%2Flibmm-camcorder.git Fix resource manager memory leak issue Change-Id: I1e109efe9e54aa566236d5c0857a50334e9a573f --- diff --git a/packaging/libmm-camcorder.spec b/packaging/libmm-camcorder.spec index c33c638..d539002 100644 --- a/packaging/libmm-camcorder.spec +++ b/packaging/libmm-camcorder.spec @@ -1,6 +1,6 @@ Name: libmm-camcorder Summary: Camera and recorder library -Version: 0.10.203 +Version: 0.10.204 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 diff --git a/src/mm_camcorder_rm.c b/src/mm_camcorder_rm.c index 0d8ccb5..104f3b2 100644 --- a/src/mm_camcorder_rm.c +++ b/src/mm_camcorder_rm.c @@ -216,23 +216,37 @@ int _mmcamcorder_rm_deallocate(MMHandleType handle) rm_device_request_s requested; mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); + rm_device_return_s *r_devices; if (!hcamcorder->rm_handle) { _mmcam_dbg_err("Resource is not initialized "); return MM_ERROR_RESOURCE_NOT_INITIALIZED; } - if (hcamcorder->returned_devices.allocated_num > 0) { + r_devices = &hcamcorder->returned_devices; + + if (r_devices->allocated_num > 0) { memset(&requested, 0x0, sizeof(rm_device_request_s)); - requested.request_num = hcamcorder->returned_devices.allocated_num; + requested.request_num = r_devices->allocated_num; for (idx = 0; idx < requested.request_num; idx++) - requested.device_id[idx] = hcamcorder->returned_devices.device_id[idx]; + requested.device_id[idx] = r_devices->device_id[idx]; rm_ret = rm_deallocate_resources(hcamcorder->rm_handle, &requested); if (rm_ret != RM_OK) _mmcam_dbg_err("Resource deallocation request failed "); } + for (idx = 0; idx < r_devices->allocated_num; idx++) { + if (r_devices->device_node[idx]) { + free(r_devices->device_node[idx]); + r_devices->device_node[idx] = NULL; + } + if (r_devices->omx_comp_name[idx]) { + free(r_devices->omx_comp_name[idx]); + r_devices->omx_comp_name[idx] = NULL; + } + } + return MM_ERROR_NONE; }