From: nibha2 Date: Fri, 23 Feb 2018 08:40:47 +0000 (+0530) Subject: [TBT][tbtcoreapp][NonACR][Svace fix] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F78%2F171078%2F1;p=test%2Ftct%2Fnative%2Fbehavior.git [TBT][tbtcoreapp][NonACR][Svace fix] Change-Id: Icefd6c972e38c3904fd2b2d5abba8b1e88300238 Signed-off-by: nibha2 --- diff --git a/tbtcoreapp/src/view/tbt-cbhm-view.c b/tbtcoreapp/src/view/tbt-cbhm-view.c index f61d044..7dcb03b 100755 --- a/tbtcoreapp/src/view/tbt-cbhm-view.c +++ b/tbtcoreapp/src/view/tbt-cbhm-view.c @@ -117,6 +117,8 @@ static void _app_destroy_cb(void* this); static char *get_selection_type(cbhm_sel_type_e type) { char msg[40]; + snprintf(msg, sizeof(msg), "Unknow Type"); + switch(type) { case CBHM_SEL_TYPE_TEXT : @@ -134,8 +136,6 @@ static char *get_selection_type(cbhm_sel_type_e type) case CBHM_SEL_TYPE_IMAGE : snprintf(msg, sizeof(msg), "CBHM_SEL_TYPE_IMAGE"); break; - default : - snprintf(msg, sizeof(msg), "Unknow Type"); } return strdup(msg); } @@ -210,13 +210,19 @@ static void _selection_type_set_cb(cbhm_sel_type_e type, void *data) char *hello_str; cbhm_view *this = (cbhm_view*) data; hello_str = (char *) malloc(50); - snprintf(hello_str, 50, "String : %s", get_selection_type(type)); + char *selection_str = NULL; + selection_str = get_selection_type(type); + + snprintf(hello_str, 50, "String : %s", selection_str); nRet = cbhm_selection_type_set(this->cbhm_handle, type); - RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_selection_type_set failed"); + RETM_IF_CLEANUP(nRet != CBHM_ERROR_NONE, "cbhm_selection_type_set failed", SAFE_DELETE(hello_str); SAFE_DELETE(selection_str)); nRet = cbhm_selection_set(this->cbhm_handle, type, hello_str, strlen(hello_str)); - RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_selection_set failed"); + RETM_IF_CLEANUP(nRet != CBHM_ERROR_NONE, "cbhm_selection_set failed", SAFE_DELETE(hello_str); SAFE_DELETE(selection_str)); + + SAFE_DELETE(selection_str); + SAFE_DELETE(hello_str); } @@ -275,7 +281,7 @@ cbhm_view *cbhm_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_Item RETVM_IF(!this, NULL, "calloc failed"); this->view = calloc(1, sizeof(common_view)); - RETVM_IF(!this->view, NULL, "calloc failed"); + RETVM_IF_CLEANUP(!this->view, NULL, "calloc failed", SAFE_DELETE(this)); tbt_info->layout_group = "cbhm_test"; tbt_info->layout_file = get_edje_path("cbhm_viewer.edj"); @@ -283,10 +289,9 @@ cbhm_view *cbhm_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_Item common_view_add(navi, tbt_info, item, this->view, _app_destroy_cb, this); - RETVM_IF(NULL == this->view, NULL, "navi is null"); nRet = cbhm_open_service(&(this->cbhm_handle)); - RETVM_IF(nRet != CBHM_ERROR_NONE, NULL, "cbhm_open_service failed"); - RETVM_IF(this->cbhm_handle == NULL, NULL, "cbhm_handle is NULL"); + RETVM_IF_CLEANUP(nRet != CBHM_ERROR_NONE, NULL, "cbhm_open_service failed", SAFE_DELETE(this->view); SAFE_DELETE(this)); + RETVM_IF_CLEANUP(this->cbhm_handle == NULL, NULL, "cbhm_handle is NULL", SAFE_DELETE(this->view); SAFE_DELETE(this)); this->apptype = tbt_info->apptype; this->lat_label = ui_utils_label_add(this->view->layout, "???"); @@ -544,6 +549,8 @@ static void _show_cbhm_state_button_pressed_cb(void *data, Evas_Object *obj, voi int nRet = cbhm_state_get(this->cbhm_handle, &sType); RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_state_get failed"); + ui_utils_label_set_text(this->lat_label, "Unknown State", "left"); + switch(sType) { case CBHM_STATE_NONE : @@ -555,8 +562,6 @@ static void _show_cbhm_state_button_pressed_cb(void *data, Evas_Object *obj, voi case CBHM_STATE_HIDE : ui_utils_label_set_text(this->lat_label, "Clip Board State is : Hide", "left"); break; - default : - ui_utils_label_set_text(this->lat_label, "Unknown State", "left"); } }