From: Sangyoon Jang Date: Thu, 25 Oct 2018 06:47:45 +0000 (+0900) Subject: Fix capmgr_app_control_set_device() X-Git-Tag: accepted/tizen/unified/20190215.055035~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3b6451caca10ce615beeaee8f795772968a0095a;p=platform%2Fcore%2Fapi%2Fcapability-manager.git Fix capmgr_app_control_set_device() If device is already set, destroy the previous one. Change-Id: I40a305fbf7472645dc6cb994f34a49e3f6b33a76 Signed-off-by: Sangyoon Jang --- diff --git a/src/client.cc b/src/client.cc index b01f4ee..97a9d7e 100644 --- a/src/client.cc +++ b/src/client.cc @@ -353,6 +353,9 @@ API int capmgr_app_control_set_device(capmgr_app_control_h app_control, if (!app_control || !device) return CAPMGR_ERROR_INVALID_PARAMETER; + if (app_control->device) + capmgr_device_destroy(app_control->device); + int ret = capmgr_device_clone(device, &app_control->device); if (ret != CAPMGR_ERROR_NONE) return CAPMGR_ERROR_OUT_OF_MEMORY;