From 3b6451caca10ce615beeaee8f795772968a0095a Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Thu, 25 Oct 2018 15:47:45 +0900 Subject: [PATCH] Fix capmgr_app_control_set_device() If device is already set, destroy the previous one. Change-Id: I40a305fbf7472645dc6cb994f34a49e3f6b33a76 Signed-off-by: Sangyoon Jang --- src/client.cc | 3 +++ 1 file changed, 3 insertions(+) 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; -- 2.7.4