Fix capmgr_app_control_set_device()
authorSangyoon Jang <jeremy.jang@samsung.com>
Thu, 25 Oct 2018 06:47:45 +0000 (15:47 +0900)
committer장상윤/Tizen Platform Lab(SR)/Engineer/삼성전자 <jeremy.jang@samsung.com>
Thu, 25 Oct 2018 10:49:08 +0000 (19:49 +0900)
If device is already set, destroy the previous one.

Change-Id: I40a305fbf7472645dc6cb994f34a49e3f6b33a76
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
src/client.cc

index b01f4ee..97a9d7e 100644 (file)
@@ -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;