From: ABHISHEK JAIN Date: Mon, 18 Sep 2017 07:24:29 +0000 (+0530) Subject: [SVACE][TBT_M][Fixed SVACE Issues for TBT_M module] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F61%2F150661%2F5;p=test%2Ftct%2Fnative%2Fbehavior.git [SVACE][TBT_M][Fixed SVACE Issues for TBT_M module] Signed-off-by: ABHISHEK JAIN Change-Id: I9fddfcf451f2414b28beaea67b6df4531ec901b3 --- diff --git a/coretbt_dataprovider/src/coretbt_dataprovider.c b/coretbt_dataprovider/src/coretbt_dataprovider.c index 57feb58..d3dabe9 100644 --- a/coretbt_dataprovider/src/coretbt_dataprovider.c +++ b/coretbt_dataprovider/src/coretbt_dataprovider.c @@ -458,9 +458,8 @@ void add_value_request_cb(int request_id, data_control_h provider, const char *k */ int create_database() { - snprintf(DB_PATH, sizeof(DB_PATH), "%s/dataprovider.db", app_get_data_path()); - DBG("database creation failed with error: %s",DB_PATH); - remove(DB_PATH); + + snprintf(DB_PATH, sizeof(DB_PATH), "%sdataprovider.db", app_get_data_path()); char* sql_command = "CREATE TABLE IF NOT EXISTS provider (ID INTEGER PRIMARY KEY AUTOINCREMENT,WORD VARCHAR(30), WORD_DESC TEXT, WORD_LEN INT, WORD_DESC_LEN INT64,WORD_NUMBER DOUBLE, WORD_BLOB VARBINARY(50))"; int open_flags = (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE); diff --git a/coretbt_uiapp/inc/coretbt_uiapp.h b/coretbt_uiapp/inc/coretbt_uiapp.h index f8bbcab..1d3b51b 100644 --- a/coretbt_uiapp/inc/coretbt_uiapp.h +++ b/coretbt_uiapp/inc/coretbt_uiapp.h @@ -66,11 +66,14 @@ typedef enum { static inline device_type_e get_device_type() { - int width, height; + int width = -1, height = -1; device_type_e device_type = DEVICE_TYPE_NONE; system_info_get_platform_int("tizen.org/feature/screen.width", &width); system_info_get_platform_int("tizen.org/feature/screen.height", &height); + RETVM_IF(width == -1, DEVICE_TYPE_NONE, "screen width is not correct"); + RETVM_IF(height == -1, DEVICE_TYPE_NONE, "screen height is not correct"); + if(width == 360 && height == 360) { //circle diff --git a/coretbtwidgetapp/src/coretbtwidgetapp.c b/coretbtwidgetapp/src/coretbtwidgetapp.c index c5ccc9a..a834aed 100644 --- a/coretbtwidgetapp/src/coretbtwidgetapp.c +++ b/coretbtwidgetapp/src/coretbtwidgetapp.c @@ -100,6 +100,7 @@ static int widget_instance_create(widget_context_h context, bundle *content, int if (!(wid->win)) { DBG("widget_app win NULL"); + SAFE_DELETE(wid); return -1; } diff --git a/multiclass/src/multiclass.c b/multiclass/src/multiclass.c index 7af16a9..66a85c9 100755 --- a/multiclass/src/multiclass.c +++ b/multiclass/src/multiclass.c @@ -10,14 +10,18 @@ typedef struct widget_instance_data { static int widget_instance_create(widget_context_h context, bundle *content, int w, int h, void *user_data) { widget_instance_data_s *wid = (widget_instance_data_s *)calloc(1, sizeof(widget_instance_data_s)); - int ret; - + if(wid == NULL) + { + return WIDGET_ERROR_FAULT; + } dlog_print(DLOG_DEBUG, LOG_TAG, "id: %s", widget_app_get_id(context)); /* window */ - ret = widget_app_get_elm_win(context, &wid->win); + int ret = widget_app_get_elm_win(context, &wid->win); if (ret != WIDGET_ERROR_NONE) { dlog_print(DLOG_ERROR, LOG_TAG, "failed to get window. err = %d", ret); + free(wid); + wid = NULL; return WIDGET_ERROR_FAULT; } diff --git a/operationpickviewapp/src/operationpickviewapp.c b/operationpickviewapp/src/operationpickviewapp.c index 155e52a..351dad1 100644 --- a/operationpickviewapp/src/operationpickviewapp.c +++ b/operationpickviewapp/src/operationpickviewapp.c @@ -366,8 +366,8 @@ static void app_control(app_control_h app_control, void *data) // elm_genlist_item_append(ad->files_list, _itc, "amlan", NULL, ELM_GENLIST_ITEM_NONE, list_item_clicked_cb, NULL); // elm_genlist_item_class_free(_itc); - - + eina_list_free(file_list); + eina_list_free(ad->files_list); } } } @@ -648,6 +648,10 @@ static void show_video(void* data) this->video_player_data = (videoplayer_data_s*) malloc(sizeof(videoplayer_data_s)); + if(this->video_player_data == NULL) + { + return; + } this->video_player_data->video_rect = this->video_rect; this->video_player_data->player = NULL; this->video_player_data->uri = this->uri; @@ -663,6 +667,10 @@ static void show_audio(void* data) appdata_s *this = (appdata_s*) data; this->sound_player_data = (soundplayer_data_s*) malloc(sizeof(soundplayer_data_s)); + if(this->sound_player_data == NULL) + { + return; + } this->sound_player_data->uri = this->uri; this->sound_player_data->player = create_sound_player(this->sound_player_data); diff --git a/operationpickviewapp/src/videoplayer-util.c b/operationpickviewapp/src/videoplayer-util.c index 77c56de..790ee7b 100644 --- a/operationpickviewapp/src/videoplayer-util.c +++ b/operationpickviewapp/src/videoplayer-util.c @@ -94,25 +94,31 @@ void start_player(videoplayer_data_s *this) char* get_video_player_state(player_state_e error_state) { + char* player_state = "STATE_NOT_FOUND"; + switch(error_state) { case PLAYER_STATE_NONE: - return"PLAYER_STATE_NONE"; + player_state = "PLAYER_STATE_NONE"; + break; case PLAYER_STATE_IDLE: - return"PLAYER_STATE_IDLE"; + player_state = "PLAYER_STATE_IDLE"; + break; case PLAYER_STATE_READY: - return"PLAYER_STATE_READY"; + player_state = "PLAYER_STATE_READY"; + break; case PLAYER_STATE_PLAYING: - return"PLAYER_STATE_PLAYING"; + player_state = "PLAYER_STATE_PLAYING"; + break; case PLAYER_STATE_PAUSED: - return"PLAYER_STATE_PAUSED"; - default: - return "STATE_NOT_FOUND"; + player_state = "PLAYER_STATE_PAUSED"; + break; } + return player_state; } diff --git a/release/binary-armv7l/org.example.multiclass-1.0.0-arm.tpk b/release/binary-armv7l/org.example.multiclass-1.0.0-arm.tpk old mode 100755 new mode 100644 index 6220fa9..9aea154 Binary files a/release/binary-armv7l/org.example.multiclass-1.0.0-arm.tpk and b/release/binary-armv7l/org.example.multiclass-1.0.0-arm.tpk differ diff --git a/release/binary-armv7l/org.tizen.coretbt_dataprovider-1.0.0-arm.tpk b/release/binary-armv7l/org.tizen.coretbt_dataprovider-1.0.0-arm.tpk old mode 100755 new mode 100644 index ad77dd7..994d359 Binary files a/release/binary-armv7l/org.tizen.coretbt_dataprovider-1.0.0-arm.tpk and b/release/binary-armv7l/org.tizen.coretbt_dataprovider-1.0.0-arm.tpk differ diff --git a/release/binary-armv7l/org.tizen.coretbt_serviceapp-1.0.0-arm.tpk b/release/binary-armv7l/org.tizen.coretbt_serviceapp-1.0.0-arm.tpk old mode 100755 new mode 100644 index f12f2c9..2349177 Binary files a/release/binary-armv7l/org.tizen.coretbt_serviceapp-1.0.0-arm.tpk and b/release/binary-armv7l/org.tizen.coretbt_serviceapp-1.0.0-arm.tpk differ diff --git a/release/binary-armv7l/org.tizen.coretbt_uiapp-1.0.0-arm.tpk b/release/binary-armv7l/org.tizen.coretbt_uiapp-1.0.0-arm.tpk old mode 100755 new mode 100644 index 90dbae3..898882f Binary files a/release/binary-armv7l/org.tizen.coretbt_uiapp-1.0.0-arm.tpk and b/release/binary-armv7l/org.tizen.coretbt_uiapp-1.0.0-arm.tpk differ diff --git a/release/binary-armv7l/org.tizen.coretbtwidgetapp-1.0.0-arm.tpk b/release/binary-armv7l/org.tizen.coretbtwidgetapp-1.0.0-arm.tpk old mode 100755 new mode 100644 index 2b230ee..79b26ed Binary files a/release/binary-armv7l/org.tizen.coretbtwidgetapp-1.0.0-arm.tpk and b/release/binary-armv7l/org.tizen.coretbtwidgetapp-1.0.0-arm.tpk differ diff --git a/release/binary-armv7l/org.tizen.operationpickviewapp-1.0.0-arm.tpk b/release/binary-armv7l/org.tizen.operationpickviewapp-1.0.0-arm.tpk old mode 100755 new mode 100644 index 6bee732..c61ddb4 Binary files a/release/binary-armv7l/org.tizen.operationpickviewapp-1.0.0-arm.tpk and b/release/binary-armv7l/org.tizen.operationpickviewapp-1.0.0-arm.tpk differ diff --git a/release/binary-armv7l/org.tizen.tbt-ime-1.0.0-arm.tpk b/release/binary-armv7l/org.tizen.tbt-ime-1.0.0-arm.tpk old mode 100755 new mode 100644 index b291c28..160c1c2 Binary files a/release/binary-armv7l/org.tizen.tbt-ime-1.0.0-arm.tpk and b/release/binary-armv7l/org.tizen.tbt-ime-1.0.0-arm.tpk differ diff --git a/release/binary-armv7l/org.tizen.tbt_pushtestapp-1.0.0-arm.tpk b/release/binary-armv7l/org.tizen.tbt_pushtestapp-1.0.0-arm.tpk old mode 100755 new mode 100644 index 76b1a14..83150be Binary files a/release/binary-armv7l/org.tizen.tbt_pushtestapp-1.0.0-arm.tpk and b/release/binary-armv7l/org.tizen.tbt_pushtestapp-1.0.0-arm.tpk differ diff --git a/release/binary-armv7l/org.tizen.tbt_ui_viewmgr-1.0.0-arm.tpk b/release/binary-armv7l/org.tizen.tbt_ui_viewmgr-1.0.0-arm.tpk old mode 100755 new mode 100644 index f031157..0299b7c Binary files a/release/binary-armv7l/org.tizen.tbt_ui_viewmgr-1.0.0-arm.tpk and b/release/binary-armv7l/org.tizen.tbt_ui_viewmgr-1.0.0-arm.tpk differ diff --git a/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk b/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk index c3130bf..7730a48 100644 Binary files a/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk and b/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk differ diff --git a/release/binary-armv7l/org.tizen.tbtcoreapp-dali-1.0.0-arm.tpk b/release/binary-armv7l/org.tizen.tbtcoreapp-dali-1.0.0-arm.tpk old mode 100755 new mode 100644 index 0f4fce7..196c7d3 Binary files a/release/binary-armv7l/org.tizen.tbtcoreapp-dali-1.0.0-arm.tpk and b/release/binary-armv7l/org.tizen.tbtcoreapp-dali-1.0.0-arm.tpk differ diff --git a/release/binary-x86/org.example.multiclass-1.0.0-x86.tpk b/release/binary-x86/org.example.multiclass-1.0.0-x86.tpk old mode 100755 new mode 100644 index 92a56cc..5dbc722 Binary files a/release/binary-x86/org.example.multiclass-1.0.0-x86.tpk and b/release/binary-x86/org.example.multiclass-1.0.0-x86.tpk differ diff --git a/release/binary-x86/org.tizen.coretbt_dataprovider-1.0.0-x86.tpk b/release/binary-x86/org.tizen.coretbt_dataprovider-1.0.0-x86.tpk old mode 100755 new mode 100644 index 1c46653..08b0b70 Binary files a/release/binary-x86/org.tizen.coretbt_dataprovider-1.0.0-x86.tpk and b/release/binary-x86/org.tizen.coretbt_dataprovider-1.0.0-x86.tpk differ diff --git a/release/binary-x86/org.tizen.coretbt_serviceapp-1.0.0-x86.tpk b/release/binary-x86/org.tizen.coretbt_serviceapp-1.0.0-x86.tpk old mode 100755 new mode 100644 index 3ddca69..b804e42 Binary files a/release/binary-x86/org.tizen.coretbt_serviceapp-1.0.0-x86.tpk and b/release/binary-x86/org.tizen.coretbt_serviceapp-1.0.0-x86.tpk differ diff --git a/release/binary-x86/org.tizen.coretbt_uiapp-1.0.0-x86.tpk b/release/binary-x86/org.tizen.coretbt_uiapp-1.0.0-x86.tpk old mode 100755 new mode 100644 index b8b0859..ac9af71 Binary files a/release/binary-x86/org.tizen.coretbt_uiapp-1.0.0-x86.tpk and b/release/binary-x86/org.tizen.coretbt_uiapp-1.0.0-x86.tpk differ diff --git a/release/binary-x86/org.tizen.coretbtwidgetapp-1.0.0-x86.tpk b/release/binary-x86/org.tizen.coretbtwidgetapp-1.0.0-x86.tpk old mode 100755 new mode 100644 index abd59f7..0b2930e Binary files a/release/binary-x86/org.tizen.coretbtwidgetapp-1.0.0-x86.tpk and b/release/binary-x86/org.tizen.coretbtwidgetapp-1.0.0-x86.tpk differ diff --git a/release/binary-x86/org.tizen.operationpickviewapp-1.0.0-x86.tpk b/release/binary-x86/org.tizen.operationpickviewapp-1.0.0-x86.tpk old mode 100755 new mode 100644 index a35e234..8b4dc3d Binary files a/release/binary-x86/org.tizen.operationpickviewapp-1.0.0-x86.tpk and b/release/binary-x86/org.tizen.operationpickviewapp-1.0.0-x86.tpk differ diff --git a/release/binary-x86/org.tizen.tbt-ime-1.0.0-x86.tpk b/release/binary-x86/org.tizen.tbt-ime-1.0.0-x86.tpk old mode 100755 new mode 100644 index 108dc86..295f1b7 Binary files a/release/binary-x86/org.tizen.tbt-ime-1.0.0-x86.tpk and b/release/binary-x86/org.tizen.tbt-ime-1.0.0-x86.tpk differ diff --git a/release/binary-x86/org.tizen.tbt_pushtestapp-1.0.0-x86.tpk b/release/binary-x86/org.tizen.tbt_pushtestapp-1.0.0-x86.tpk old mode 100755 new mode 100644 index 641e836..618ef7e Binary files a/release/binary-x86/org.tizen.tbt_pushtestapp-1.0.0-x86.tpk and b/release/binary-x86/org.tizen.tbt_pushtestapp-1.0.0-x86.tpk differ diff --git a/release/binary-x86/org.tizen.tbt_ui_viewmgr-1.0.0-x86.tpk b/release/binary-x86/org.tizen.tbt_ui_viewmgr-1.0.0-x86.tpk old mode 100755 new mode 100644 index f72999f..3ddfb60 Binary files a/release/binary-x86/org.tizen.tbt_ui_viewmgr-1.0.0-x86.tpk and b/release/binary-x86/org.tizen.tbt_ui_viewmgr-1.0.0-x86.tpk differ diff --git a/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-x86.tpk b/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-x86.tpk index 6c8408c..63765b2 100644 Binary files a/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-x86.tpk and b/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-x86.tpk differ diff --git a/release/binary-x86/org.tizen.tbtcoreapp-dali-1.0.0-x86.tpk b/release/binary-x86/org.tizen.tbtcoreapp-dali-1.0.0-x86.tpk old mode 100755 new mode 100644 index 09640f2..7eccf38 Binary files a/release/binary-x86/org.tizen.tbtcoreapp-dali-1.0.0-x86.tpk and b/release/binary-x86/org.tizen.tbtcoreapp-dali-1.0.0-x86.tpk differ diff --git a/tbt-ime/src/tbt-ime.c b/tbt-ime/src/tbt-ime.c index 24fd00e..5fd9f20 100644 --- a/tbt-ime/src/tbt-ime.c +++ b/tbt-ime/src/tbt-ime.c @@ -238,13 +238,15 @@ static void _preedit_on_key_clicked(void *data, Evas_Object *obj EINA_UNUSED, vo this->list = eina_list_append(this->list, attr); ret = ime_update_preedit_string("abcd", this->list); - RETM_IF(IME_ERROR_NONE!=ret, "ime_update_preedit_string fails :%s",_get_ime_error(ret)); if (ret != IME_ERROR_NONE) { EINA_LIST_FREE(this->list, attr) SAFE_DELETE(attr); + return; } + SAFE_DELETE(attr); + } @@ -526,7 +528,7 @@ static void ise_template_create_cb(void *user_data) DBG("MSG :%s", MSG); } RETM_IF(NULL == data->info_msg, "Message is NULL"); - btn = _create_key_button(layout, ((char*)MSG == NULL || strlen(MSG) == 0)?data->info_msg:MSG); + btn = _create_key_button(layout, (strlen(MSG) == 0)?data->info_msg:MSG); str = format_string("%s%d%d", "btn_", 0, 0); elm_object_part_content_set(layout, str, btn); SAFE_DELETE(str); @@ -1147,11 +1149,12 @@ void ime_app_main(int argc, char **argv) result = ime_event_set_option_window_destroyed_cb(ise_template_option_window_destroyed_cb, data); // Start IME ime_run(&basic_callback, data); + SAFE_DELETE(data); } static char* get_ecore_imf_device_class(Ecore_IMF_Device_Class e) { - char* str = NULL; + char* str = "UNKWON_CLASS"; switch(e) { case ECORE_IMF_DEVICE_CLASS_NONE: @@ -1178,9 +1181,6 @@ static char* get_ecore_imf_device_class(Ecore_IMF_Device_Class e) case ECORE_IMF_DEVICE_CLASS_GAMEPAD: str = "ECORE_IMF_DEVICE_CLASS_GAMEPAD"; break; - default: - str = "UNKWON_CLASS"; - break; } return str; } diff --git a/tbt_pushtestapp/src/tbt_pushtestapp.c b/tbt_pushtestapp/src/tbt_pushtestapp.c index b1442f7..53e047a 100644 --- a/tbt_pushtestapp/src/tbt_pushtestapp.c +++ b/tbt_pushtestapp/src/tbt_pushtestapp.c @@ -235,21 +235,20 @@ static bool _storage_device_supported_cb(int storage_id, storage_type_e type, st return true; } -static char* get_xml_element_value (xmlDocPtr doc, xmlNodePtr cur, const char* tag) +void get_xml_element_value(xmlDocPtr doc, xmlNodePtr cur, const char* tag, char** str) { - +DBG("get_xml_element_value"); xmlChar *key; - char* str; cur = cur->xmlChildrenNode; while (cur != NULL) { if ((!xmlStrcmp(cur->name, (const xmlChar *)tag))) { key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); - str = strdup((char*)key); + *str = strdup((char*)key); xmlFree(key); + break; } cur = cur->next; } - return str; } static void start_push_operation(void* data) @@ -272,13 +271,12 @@ static void start_push_operation(void* data) init_xml_operation(this); - this->push_app_id_text = get_xml_element_value(this->doc, this->root_node_ptr, "TestappID"); + get_xml_element_value(this->doc, this->root_node_ptr, "TestappID",&(this->push_app_id_text)); DBG("appID: %s", this->push_app_id_text); //this->push_app_id_text = PUSH_APP_ID; ret = push_service_connect(this->push_app_id_text, _state_changed_cb, _notify_cb, this, &connection); RETM_IF(ret != PUSH_SERVICE_ERROR_NONE, "push_service_connect :%s",push_service_get_error(ret)); - - + free(this->push_app_id_text); } static void init_xml_operation(void* data) diff --git a/tbt_ui_viewmgr/src/view1.c b/tbt_ui_viewmgr/src/view1.c index fb6ff4e..6218e6b 100644 --- a/tbt_ui_viewmgr/src/view1.c +++ b/tbt_ui_viewmgr/src/view1.c @@ -108,16 +108,7 @@ view1_rotate(ui_view *view, void *user_data) ui_menu *menu = ui_view_get_menu(view); int rotation; - if (ui_view_get_orientation_mode(view) == UI_VIEW_ORIENTATION_MODE_PORTRAIT) - { - /* Portrait mode. */ - rotation = ui_menu_get_degree(menu); - } - else - { - /* Landscape mode. */ - rotation = ui_menu_get_degree(menu); - } + rotation = ui_menu_get_degree(menu); DBG("rotation %d", rotation); char str[256]; diff --git a/tbtcoreapp-dali/src/utils/dali-ui-utils.cpp b/tbtcoreapp-dali/src/utils/dali-ui-utils.cpp index ea00ea3..4929f15 100644 --- a/tbtcoreapp-dali/src/utils/dali-ui-utils.cpp +++ b/tbtcoreapp-dali/src/utils/dali-ui-utils.cpp @@ -300,8 +300,12 @@ void UiUtils::AddLabelToTable(TableView table,Property::Map keyMap, Property::Ma bool UiUtils::OnPassButtonClick(Button button) { DBG("UiUtils::OnPassButtonClick"); - app_control_h reply; - int nStatus = app_control_create(&reply); + app_control_h reply = NULL; + int nStatus = -1; + nStatus = app_control_create(&reply); + + RETVM_IF(nStatus == -1, false, "control handle creation failed"); + RETVM_IF(reply == NULL, false, "control handle creation failed"); app_control_result_e res = APP_CONTROL_RESULT_SUCCEEDED; nStatus = app_control_reply_to_launch_request(reply, _control, res); @@ -313,8 +317,12 @@ bool UiUtils::OnPassButtonClick(Button button) bool UiUtils::OnFailButtonClick(Button button) { DBG("UiUtils::OnFailButtonClick"); - app_control_h reply; - int nStatus = app_control_create(&reply); + app_control_h reply = NULL; + int nStatus = -1; + nStatus = app_control_create(&reply); + + RETVM_IF(nStatus == -1, false, "control handle creation failed"); + RETVM_IF(reply == NULL, false, "control handle creation failed"); app_control_result_e res = APP_CONTROL_RESULT_FAILED; nStatus = app_control_reply_to_launch_request(reply, _control, res); diff --git a/tbtcoreapp-dali/src/view/tbt-dali-actor-view.cpp b/tbtcoreapp-dali/src/view/tbt-dali-actor-view.cpp index 5d4bf1f..71cef4f 100644 --- a/tbtcoreapp-dali/src/view/tbt-dali-actor-view.cpp +++ b/tbtcoreapp-dali/src/view/tbt-dali-actor-view.cpp @@ -27,26 +27,16 @@ std::string GetState ( TouchPoint::State state ) { - std::string ret=""; + std::string ret="None"; switch(state) { case TouchPoint::Started: - { - if(TouchPoint::Started==state) - ret="Started"; - else - ret="Down"; - } + ret="Started"; break; case TouchPoint::Finished: - { - if(TouchPoint::Finished==state) - ret="Finished"; - else - ret="Up"; - } - break; + ret="Finished"; + break; case TouchPoint::Motion: ret="Motion"; @@ -67,17 +57,13 @@ std::string GetState ( TouchPoint::State state ) case TouchPoint::Last: ret="Last"; break; - - default: - ret="None"; - break; } return ret; } std::string GetPointState ( PointState::Type state ) { - std::string str=""; + std::string str="None"; switch(state) { case PointState::STARTED: @@ -98,9 +84,6 @@ std::string GetPointState ( PointState::Type state ) case PointState::INTERRUPTED: str="INTERRUPTED"; break; - default: - str="None"; - break; } return str; } diff --git a/tbtcoreapp-dali/src/view/tbt-dali-stage-view.cpp b/tbtcoreapp-dali/src/view/tbt-dali-stage-view.cpp index c69f982..2d72ffe 100644 --- a/tbtcoreapp-dali/src/view/tbt-dali-stage-view.cpp +++ b/tbtcoreapp-dali/src/view/tbt-dali-stage-view.cpp @@ -47,7 +47,7 @@ TBTDaliStageView::TBTDaliStageView(Application& mApplication, app_control_h _con Stage stage = Stage::GetCurrent(); Vector2 stageSize = stage.GetSize(); - + bCheck = false; Property::Map ctl; //ctl["lbl1"]=" Context lost signal not call"; //ctl["lbl2"]=" Context regain signal not call"; diff --git a/tbtcoreapp-dali/src/view/tbt-dali-style-manager-view.cpp b/tbtcoreapp-dali/src/view/tbt-dali-style-manager-view.cpp index c533bdd..71ac038 100644 --- a/tbtcoreapp-dali/src/view/tbt-dali-style-manager-view.cpp +++ b/tbtcoreapp-dali/src/view/tbt-dali-style-manager-view.cpp @@ -70,6 +70,7 @@ bool TBTDaliStyleManagerView::OnClicked(Button button) styleManager.ApplyDefaultTheme(); styleManager.ApplyStyle( btnStyle, IMAGE_PATH, "testbutton" ); styleManager.ApplyStyle( lblStyleManager, IMAGE_PATH, "textlabel" ); + free(IMAGE_PATH); return true; } void TBTDaliStyleManagerView::OnStyleChange(StyleManager style,StyleChange::Type type) diff --git a/tbtcoreapp-dali/src/view/tbt-dali-touch-data-view.cpp b/tbtcoreapp-dali/src/view/tbt-dali-touch-data-view.cpp index eacc984..9721f68 100644 --- a/tbtcoreapp-dali/src/view/tbt-dali-touch-data-view.cpp +++ b/tbtcoreapp-dali/src/view/tbt-dali-touch-data-view.cpp @@ -26,26 +26,16 @@ #include "view/tbt-dali-touch-data-view.h" std::string GetTouchDataState ( TouchPoint::State state ) { - std::string ret=""; + std::string ret="None"; switch(state) { case TouchPoint::Started: - { - if(TouchPoint::Started==state) - ret="Started"; - else - ret="Down"; - } - break; + ret="Started"; + break; case TouchPoint::Finished: - { - if(TouchPoint::Finished==state) - ret="Finished"; - else - ret="Up"; - } - break; + ret="Finished"; + break; case TouchPoint::Motion: ret="Motion"; @@ -66,17 +56,13 @@ std::string GetTouchDataState ( TouchPoint::State state ) case TouchPoint::Last: ret="Last"; break; - - default: - ret="None"; - break; } return ret; } std::string GetTouchDataPointState ( PointState::Type state ) { - std::string str=""; + std::string str="None"; switch(state) { case PointState::STARTED: @@ -97,9 +83,6 @@ std::string GetTouchDataPointState ( PointState::Type state ) case PointState::INTERRUPTED: str="INTERRUPTED"; break; - default: - str="None"; - break; } return str; } diff --git a/tbtcoreapp/inc/utils/config.h b/tbtcoreapp/inc/utils/config.h index f08e053..9a59f7f 100644 --- a/tbtcoreapp/inc/utils/config.h +++ b/tbtcoreapp/inc/utils/config.h @@ -270,6 +270,10 @@ char file_path[MAX_LENGTH] = {'\0'}; #endif int num = strlen(file_name); + if(num<0) + { + return NULL; + } if(strlen(file_path)+strlen(file_name) <= MAX_LENGTH) { num = strlen(file_name); diff --git a/tbtcoreapp/inc/utils/logger.h b/tbtcoreapp/inc/utils/logger.h index 772ceab..a68a8bd 100644 --- a/tbtcoreapp/inc/utils/logger.h +++ b/tbtcoreapp/inc/utils/logger.h @@ -43,6 +43,17 @@ } \ } +#define RETM_IF_CLEANUP(expr, fmt, FreeResource, arg...) \ +{ \ + if (expr) \ + { \ + ERR(fmt, ##arg); \ + FreeResource; \ + return; \ + } \ +} + + #define RETVM_IF(expr, val, fmt, arg...) \ { \ if (expr) \ @@ -52,6 +63,16 @@ } \ } +#define RETVM_IF_CLEANUP(expr, val, fmt, FreeResource, arg...) \ +{ \ + if (expr) \ + { \ + ERR(fmt, ##arg); \ + FreeResource; \ + return (val); \ + } \ +} + #define SAFE_DELETE(a) if( (a) != NULL ) free (a); (a) = NULL; #endif /* __LOGGER_H__ */ diff --git a/tbtcoreapp/src/utils/util_state_object.c b/tbtcoreapp/src/utils/util_state_object.c index 81c6310..7fdcf7f 100644 --- a/tbtcoreapp/src/utils/util_state_object.c +++ b/tbtcoreapp/src/utils/util_state_object.c @@ -268,6 +268,8 @@ util_state_transition* util_state_object_add_transition(util_state_object *objec if(transition==NULL) { transition=malloc(sizeof(util_state_transition)); + RETVM_IF(transition == NULL,NULL,"transition is null"); + transition->destination=to; transition->input=feed_value; from->transitions = g_list_append(from->transitions,transition); diff --git a/tbtcoreapp/src/utils/xml-util.c b/tbtcoreapp/src/utils/xml-util.c index ee8d642..2c7c85f 100644 --- a/tbtcoreapp/src/utils/xml-util.c +++ b/tbtcoreapp/src/utils/xml-util.c @@ -107,12 +107,12 @@ void xmlUtil_writeResults(const char *inputFilePath,tbt_info *moduleList,const i // get summary info for (i = 0; i < testDataCount; i++) { - DBG("3 %d %s",i,moduleList[i].name); - test=&moduleList[i]; - // just for safety - if(moduleList[i].result>3) moduleList[i].result=TBT_INFO_RESULT_NOT_TESTED; // set result not tested - passfail[moduleList[i].result]++; + test = &moduleList[i]; + // just for safety + if(moduleList[i].result>3) + moduleList[i].result=TBT_INFO_RESULT_NOT_TESTED; // set result not tested + passfail[moduleList[i].result]++; } diff --git a/tbtcoreapp/src/view/tbt-attachpanel-view.c b/tbtcoreapp/src/view/tbt-attachpanel-view.c index 09431c3..cde3d3f 100755 --- a/tbtcoreapp/src/view/tbt-attachpanel-view.c +++ b/tbtcoreapp/src/view/tbt-attachpanel-view.c @@ -317,6 +317,7 @@ static Evas_Object* create_bubble_table(Evas_Object *parent, Message_Bubble_Styl break; } } + free(file_path); return bubble_table; } diff --git a/tbtcoreapp/src/view/tbt-bluetooth-callback-view.c b/tbtcoreapp/src/view/tbt-bluetooth-callback-view.c index 5d7f300..5270cfc 100644 --- a/tbtcoreapp/src/view/tbt-bluetooth-callback-view.c +++ b/tbtcoreapp/src/view/tbt-bluetooth-callback-view.c @@ -400,6 +400,7 @@ static void Bluetooth_adapter_device_discovery_state_changed_cb_p(int result, bt } else { + ui_utils_label_set_text(this->create_label, "Device Discovery Invoked, No Status yet", "left"); switch ( discovery_state ) { case BT_ADAPTER_DEVICE_DISCOVERY_STARTED: @@ -411,9 +412,6 @@ static void Bluetooth_adapter_device_discovery_state_changed_cb_p(int result, bt case BT_ADAPTER_DEVICE_DISCOVERY_FOUND: ui_utils_label_set_text(this->create_label, "Device Discovery Invoked, device is found", "left"); break; - default: - ui_utils_label_set_text(this->create_label, "Device Discovery Invoked, No Status yet", "left"); - break; } } } diff --git a/tbtcoreapp/src/view/tbt-bluetooth-view.c b/tbtcoreapp/src/view/tbt-bluetooth-view.c index c304970..09f5773 100644 --- a/tbtcoreapp/src/view/tbt-bluetooth-view.c +++ b/tbtcoreapp/src/view/tbt-bluetooth-view.c @@ -602,9 +602,11 @@ static void update_view_controls(bluetooth_view *this) else if(this->view->tbt_info->apptype == TBT_APP_BT_OPP_SERVER && this->is_opp_server_accecpt == EINA_FALSE) { DBG("TBT_APP_BT_OPP_SERVER"); - result = bt_opp_server_initialize_by_connection_request(get_storage_image_dir_path(), _adpter_bt_opp_server_connection_requested_cb,this); + char *server_path = get_storage_image_dir_path(); + result = bt_opp_server_initialize_by_connection_request(server_path, _adpter_bt_opp_server_connection_requested_cb,this); DBG("bt_opp_server_initialize_by_connection_request %s %s ", get_bluetooth_error(result), app_get_resource_path()); RETM_IF(result != BT_ERROR_NONE, "[bt_opp_server_initialize_by_connection_request] Failed. > Error = %s", get_bluetooth_error(result)); + free(server_path); } } else if(this->view->tbt_info->apptype == TBT_APP_BT_AUDIO_CONNECT || @@ -899,7 +901,9 @@ static void discovered_devices_list_show(bluetooth_view *this) } else { - elm_list_item_append(this->bluetooth_list, format_string("%s(Paired)", device_info->remote_name), NULL, NULL, _device_item_selected_cb, device_info); + char* str = format_string("%s(Paired)", device_info->remote_name); + elm_list_item_append(this->bluetooth_list,str , NULL, NULL, _device_item_selected_cb, device_info); + SAFE_DELETE(str); } } } @@ -1205,7 +1209,9 @@ static void _control_button_pressed_cb(void *data, Evas_Object *obj, void *event result = bt_opp_client_initialize(); RETM_IF(result != BT_ERROR_NONE, "bt_opp_client_initialize fail > Error = %d", result); - result = bt_opp_client_add_file(get_shared_resource_path(this->view->tbt_info->file_name)); + char *file_path = get_shared_resource_path(this->view->tbt_info->file_name); + result = bt_opp_client_add_file(file_path); + SAFE_DELETE(file_path); RETM_IF(result != BT_ERROR_NONE, "bt_opp_client_add_file fail > Error = %d", result); if(this->selected_device_info != NULL) @@ -1442,6 +1448,7 @@ static void _control_button_bluetooth_pressed_cb(void *data, Evas_Object *obj, v app_control_h service = NULL; result = app_control_create(&service); RETM_IF(result != APP_CONTROL_ERROR_NONE, "app_control_create Failed. > Error = %d", result); + RETM_IF(service == NULL, "app_control_create Failed - handle is NULL"); app_control_set_operation(service, "http://tizen.org/appcontrol/operation/edit"); app_control_set_mime(service, "application/x-bluetooth-visibility"); @@ -1581,6 +1588,15 @@ static void _adapter_device_discovery_state_changed_cb(int result, bt_adapter_de //Hold the last deviceinfo pointer; this->devices_list = g_list_append(this->devices_list, (gpointer)device_info); + if(this->devices_list == NULL) + { + if(device_info) + { + free(device_info->remote_name); + free(device_info->remote_address); + free(device_info); + } + } } } } @@ -1601,6 +1617,15 @@ static void _adapter_device_discovery_state_changed_cb(int result, bt_adapter_de //Hold the last deviceinfo pointer; this->devices_list = g_list_append(this->devices_list, (gpointer)device_info); + if(this->devices_list == NULL) + { + if(device_info) + { + free(device_info->remote_name); + free(device_info->remote_address); + free(device_info); + } + } } } @@ -1624,6 +1649,15 @@ static void _adapter_device_discovery_state_changed_cb(int result, bt_adapter_de //Hold the last deviceinfo pointer; this->devices_list = g_list_append(this->devices_list, (gpointer)device_info); + if(this->devices_list == NULL) + { + if(device_info) + { + free(device_info->remote_name); + free(device_info->remote_address); + free(device_info); + } + } } } @@ -1656,6 +1690,15 @@ static void _adapter_device_discovery_state_changed_cb(int result, bt_adapter_de //Hold the last deviceinfo pointer; this->devices_list = g_list_append(this->devices_list, (gpointer)device_info); + if(this->devices_list == NULL) + { + if(device_info) + { + free(device_info->remote_name); + free(device_info->remote_address); + free(device_info); + } + } } } @@ -1678,6 +1721,15 @@ static void _adapter_device_discovery_state_changed_cb(int result, bt_adapter_de //Hold the last deviceinfo pointer; this->devices_list = g_list_append(this->devices_list, (gpointer)device_info); + if(this->devices_list == NULL) + { + if(device_info) + { + free(device_info->remote_name); + free(device_info->remote_address); + free(device_info); + } + } } } @@ -1696,6 +1748,15 @@ static void _adapter_device_discovery_state_changed_cb(int result, bt_adapter_de //Hold the last deviceinfo pointer; this->devices_list = g_list_append(this->devices_list, (gpointer)device_info); + if(this->devices_list == NULL) + { + if(device_info) + { + free(device_info->remote_name); + free(device_info->remote_address); + free(device_info); + } + } } } } @@ -1837,7 +1898,9 @@ static void _adapter_authorization_changed_cb(bt_device_authorization_e authoriz if(authorization == BT_DEVICE_AUTHORIZED) { - elm_object_item_text_set(this->selected_device_item, format_string("%s(Authorized)", this->selected_device_info->remote_name)); + char *item_text = format_string("%s(Authorized)", this->selected_device_info->remote_name); + elm_object_item_text_set(this->selected_device_item, item_text); + SAFE_DELETE(item_text); #ifdef TIZEN_3_0 ui_utils_label_set_text(this->bluetooth_label, "Authorized", "left"); #endif @@ -1847,7 +1910,9 @@ static void _adapter_authorization_changed_cb(bt_device_authorization_e authoriz } else if(authorization == BT_DEVICE_UNAUTHORIZED) { - elm_object_item_text_set(this->selected_device_item, format_string("%s(Unauthorized)", this->selected_device_info->remote_name)); + char *item_text = format_string("%s(Unauthorized)", this->selected_device_info->remote_name); + elm_object_item_text_set(this->selected_device_item,item_text ); + SAFE_DELETE(item_text); #ifdef TIZEN_3_0 ui_utils_label_set_text(this->bluetooth_label, "Unauthorized", "left"); #endif @@ -2151,6 +2216,12 @@ static bool _adapter_bonded_device_cb(bt_device_info_s *device_info, void *data) //Hold the last deviceinfo pointer; this->bonded_devices_list = g_list_append(this->bonded_devices_list, (gpointer)device_info_bonded); + if(this->bonded_devices_list == NULL) + { + free(device_info_bonded->remote_name); + free(device_info_bonded->remote_address); + free(device_info_bonded); + } if(this->view->tbt_info->apptype == TBT_APP_BT_SERVER_PAIRED || this->view->tbt_info->apptype == TBT_APP_BT_SERVER_SOCKET || @@ -2554,9 +2625,21 @@ static void _app_destroy_cb(void* this) if(view->bt_player) { - player_stop(view->bt_player); - player_unprepare(view->bt_player); - player_destroy(view->bt_player); + result = player_stop(view->bt_player); + if(result != PLAYER_ERROR_NONE) + { + DBG("[player_stop] Failed."); + } + result = player_unprepare(view->bt_player); + if(result != PLAYER_ERROR_NONE) + { + DBG("[player_unprepare] Failed."); + } + result = player_destroy(view->bt_player); + if(result != PLAYER_ERROR_NONE) + { + DBG("[player_destroy] Failed."); + } view->bt_player = NULL; } @@ -3012,7 +3095,9 @@ switch(now) elm_object_disabled_set(this->action_btn, EINA_FALSE); evas_object_data_set(this->bluetooth_list, "bluetooth_view", this); - elm_object_item_text_set(this->selected_device_item, format_string("%s(Paired)", this->selected_device_info->remote_name)); + char *item_text = format_string("%s(Paired)", this->selected_device_info->remote_name); + elm_object_item_text_set(this->selected_device_item, item_text); + SAFE_DELETE(item_text); #ifdef TIZEN_3_0 ui_utils_label_set_text(this->bluetooth_label, "Paired", "left"); #endif @@ -3038,7 +3123,9 @@ switch(now) case BT_BOND_TIMED_OUT: elm_object_disabled_set(this->action_btn, EINA_FALSE); evas_object_data_set(this->bluetooth_list, "bluetooth_view", this); - elm_object_item_text_set(this->selected_device_item, format_string("%s(Timedout)", this->selected_device_info->remote_name)); + char *item_text1 = format_string("%s(Timedout)", this->selected_device_info->remote_name); + elm_object_item_text_set(this->selected_device_item, item_text1); + SAFE_DELETE(item_text1); #ifdef TIZEN_3_0 ui_utils_label_set_text(this->bluetooth_label, "Timed Out", "left"); #endif @@ -3049,7 +3136,9 @@ switch(now) case BT_BOND_REMOTE_DEVICE_NOT_FOUND: elm_object_disabled_set(this->action_btn, EINA_FALSE); evas_object_data_set(this->bluetooth_list, "bluetooth_view", this); - elm_object_item_text_set(this->selected_device_item, format_string("%s(Device Not Found)", this->selected_device_info->remote_name)); + char *item_text2 = format_string("%s(Device Not Found)", this->selected_device_info->remote_name); + elm_object_item_text_set(this->selected_device_item, item_text2); + SAFE_DELETE(item_text2); #ifdef TIZEN_3_0 ui_utils_label_set_text(this->bluetooth_label, "Device Not Found", "left"); #endif @@ -3060,7 +3149,9 @@ switch(now) case BT_BOND_CANCELLED: elm_object_disabled_set(this->action_btn, EINA_FALSE); evas_object_data_set(this->bluetooth_list, "bluetooth_view", this); - elm_object_item_text_set(this->selected_device_item, format_string("%s(Cancelled)", this->selected_device_info->remote_name)); + char *item_text3 = format_string("%s(Cancelled)", this->selected_device_info->remote_name); + elm_object_item_text_set(this->selected_device_item, item_text3); + SAFE_DELETE(item_text3); #ifdef TIZEN_3_0 ui_utils_label_set_text(this->bluetooth_label, "Cancelled", "left"); #endif @@ -3071,7 +3162,9 @@ switch(now) case BT_BOND_AUTH_FAILED: elm_object_disabled_set(this->action_btn, EINA_FALSE); evas_object_data_set(this->bluetooth_list, "bluetooth_view", this); - elm_object_item_text_set(this->selected_device_item, format_string("%s(Auth Failed)", this->selected_device_info->remote_name)); + char *item_text4 = format_string("%s(Auth Failed)", this->selected_device_info->remote_name); + elm_object_item_text_set(this->selected_device_item, item_text4); + SAFE_DELETE(item_text4); #ifdef TIZEN_3_0 ui_utils_label_set_text(this->bluetooth_label, "Auth Failed", "left"); #endif @@ -3227,8 +3320,9 @@ switch(now) DBG("bt_device_start_service_search"); result = bt_device_start_service_search(this->selected_device_info->remote_address); RETM_IF(result != BT_ERROR_NONE, "bt_device_start_service_search fail > Error = %d", result); - - elm_object_item_text_set(this->selected_device_item, format_string("%s(Pairing)", this->selected_device_info->remote_name)); + char *item_text = format_string("%s(Pairing)", this->selected_device_info->remote_name); + elm_object_item_text_set(this->selected_device_item, item_text); + SAFE_DELETE(item_text); #ifdef TIZEN_3_0 ui_utils_label_set_text(this->bluetooth_label, "Pairing..", "left"); #endif @@ -3272,7 +3366,9 @@ switch(now) { elm_object_disabled_set(this->action_btn, EINA_TRUE); evas_object_data_set(this->bluetooth_list, "bluetooth_view", NULL); - elm_object_item_text_set(this->selected_device_item, format_string("%s(Unpairing)", this->selected_device_info->remote_name)); + char *item_text = format_string("%s(Unpairing)", this->selected_device_info->remote_name); + elm_object_item_text_set(this->selected_device_item, item_text); + SAFE_DELETE(item_text); #ifdef TIZEN_3_0 ui_utils_label_set_text(this->bluetooth_label, "Unpairing..", "left"); #endif diff --git a/tbtcoreapp/src/view/tbt-bluetoothle-view.c b/tbtcoreapp/src/view/tbt-bluetoothle-view.c index cbf3ee4..679ff72 100644 --- a/tbtcoreapp/src/view/tbt-bluetoothle-view.c +++ b/tbtcoreapp/src/view/tbt-bluetoothle-view.c @@ -1031,6 +1031,11 @@ static void _bt_adapter_le_scan_result_cb(int result, bt_adapter_le_device_scan //Hold the last deviceinfo pointer; this->devices_list = g_list_append(this->devices_list, (gpointer) device_info); + if(this->devices_list == NULL) + { + free(device_info->remote_address); + free(device_info); + } } } } @@ -1414,7 +1419,8 @@ static void services_list_show(bluetoothle_view *this) char* svc_uuid; char* str; - bt_gatt_get_uuid(service_handle, &svc_uuid); + int ret = bt_gatt_get_uuid(service_handle, &svc_uuid); + RETM_IF(ret != BT_ERROR_NONE, "bt_gatt_get_uuid fail > Error = %s", get_bluetooth_error(ret)); str = format_string("Service UUID: %s",svc_uuid); diff --git a/tbtcoreapp/src/view/tbt-camera-view.c b/tbtcoreapp/src/view/tbt-camera-view.c index 30eafde..15add6a 100644 --- a/tbtcoreapp/src/view/tbt-camera-view.c +++ b/tbtcoreapp/src/view/tbt-camera-view.c @@ -453,8 +453,6 @@ char* get_camera_state(camera_state_e state) return "CAMERA_STATE_CAPTURING"; case CAMERA_STATE_CAPTURED: return "CAMERA_STATE_CAPTURED"; - default: - return "Unknown Error"; } } @@ -886,7 +884,6 @@ static void _camera_capture_cb(camera_image_data_s *image, camera_image_data_s * { if (view->file_path != NULL) { - remove(view->file_path); SAFE_DELETE(view->file_path); } @@ -921,6 +918,10 @@ static void _camera_capture_completed_cb(void *data) RETM_IF(NULL == view->image, "ui_utils_create_image fail > Error = %s", view->file_path); elm_object_part_content_set(view->view->layout, "video_view", view->image); + if(view->file_path) + { + free(view->file_path); + } } } @@ -1013,7 +1014,7 @@ static void _camera_face_detected_cb(camera_detected_face_s *faces, int count, v //draw_lines(faces[i].x, faces[i].y, faces[i].width, faces[i].height, i, view); //DBG("x: %d, y: %d, w: %d, h: %d", faces[i].y, faces[i].x+faces[i].width, faces[i].height, faces[i].width); //draw_lines(faces[i].y, faces[i].x+faces[i].width, faces[i].height, faces[i].width, i, view); - draw_lines((canvas_width-faces[i].width)-faces[i].y, canvas_height-faces[i].x, faces[i].width, faces[i].height, i, view); + draw_lines((canvas_width-faces[i].width)-faces[i].y, canvas_height-faces[i].x, faces[i].height, faces[i].width, i, view); //draw_lines(canvas_x-faces[i].x, canvas_y-faces[i].y, faces[i].height, faces[i].width, i, view); DBG("x: %d, y: %d, w: %d, h: %d", faces[i].y, faces[i].x, faces[i].width, faces[i].height); } diff --git a/tbtcoreapp/src/view/tbt-connection-view.c b/tbtcoreapp/src/view/tbt-connection-view.c index c7f5cb2..9cbb51e 100755 --- a/tbtcoreapp/src/view/tbt-connection-view.c +++ b/tbtcoreapp/src/view/tbt-connection-view.c @@ -119,7 +119,7 @@ connection_view *connection_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_ result = connection_get_cellular_state(g_hConenctionHandle, &eFindCellularState); RETVM_IF(result != CONNECTION_ERROR_NONE, NULL, "connection_get_cellular_state fail > Error = %s", get_connection_error(result)); - + ui_utils_label_set_text(this->connection_label, "Unknown status", "left"); switch(eFindCellularState) { case CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE: @@ -145,11 +145,6 @@ connection_view *connection_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_ case CONNECTION_CELLULAR_STATE_CONNECTED: ui_utils_label_set_text(this->connection_label, "Connected ", "left"); break; - - default: - ui_utils_label_set_text(this->connection_label, "Unknown status", "left"); - break; - } } else diff --git a/tbtcoreapp/src/view/tbt-dali-view.c b/tbtcoreapp/src/view/tbt-dali-view.c index 3164958..22b2d5d 100644 --- a/tbtcoreapp/src/view/tbt-dali-view.c +++ b/tbtcoreapp/src/view/tbt-dali-view.c @@ -171,6 +171,8 @@ dali_view *dali_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_Item RETVM_IF(APP_CONTROL_ERROR_NONE != ret, NULL, "app_control_set_operation failed :%s", get_app_control_error(ret)); this->dali = (view_item*)malloc(sizeof(view_item)); + RETVM_IF(this->dali == NULL,NULL,"dali is null"); + this->dali->uri = NULL; this->dali->mime = "text/plain"; this->module_name = module_name; diff --git a/tbtcoreapp/src/view/tbt-datacontrol-view.c b/tbtcoreapp/src/view/tbt-datacontrol-view.c index d4bf0fa..465bc27 100644 --- a/tbtcoreapp/src/view/tbt-datacontrol-view.c +++ b/tbtcoreapp/src/view/tbt-datacontrol-view.c @@ -135,6 +135,7 @@ datacontrol_view *datacontrol_view_add(Evas_Object *navi, tbt_info *tbt_info, El RETVM_IF(NULL == navi, NULL, "navi is null"); this = calloc(1, sizeof(datacontrol_view)); + RETVM_IF(!this, NULL, "calloc failed"); this->view = calloc(1, sizeof(common_view)); RETVM_IF(!this->view, NULL, "calloc failed"); diff --git a/tbtcoreapp/src/view/tbt-image-view.c b/tbtcoreapp/src/view/tbt-image-view.c index 60d2e5c..04510e3 100644 --- a/tbtcoreapp/src/view/tbt-image-view.c +++ b/tbtcoreapp/src/view/tbt-image-view.c @@ -83,7 +83,7 @@ image_view *image_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_Ite evas_object_geometry_get(this->image, &x, &y, &w, &h); DBG("Dim: %d %d %d %d", x, y, w, h); - RETVM_IF(NULL == this->image, false, "create of layout elements failed"); + RETVM_IF_CLEANUP(NULL == this->image, false, "create of layout elements failed",SAFE_DELETE(file_path)); if(EINA_TRUE == elm_image_animated_available_get(this->image)) { @@ -92,6 +92,7 @@ image_view *image_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_Ite } elm_object_part_content_set(this->view->layout, "image_view", this->image); + SAFE_DELETE(file_path); return this; } diff --git a/tbtcoreapp/src/view/tbt-iotcon-view.c b/tbtcoreapp/src/view/tbt-iotcon-view.c index b71f04e..37e646d 100644 --- a/tbtcoreapp/src/view/tbt-iotcon-view.c +++ b/tbtcoreapp/src/view/tbt-iotcon-view.c @@ -161,6 +161,8 @@ Elm_Object_Item* _iotcon_elm_genlist_item_append(Evas_Object* list, char *item_t itc->func.del = _gl_del_cb; item_data *id = calloc(sizeof(item_data), 1); + RETVM_IF(id == NULL,NULL,"id is null"); + id->index = index++; id->text = strdup(item_text); @@ -1325,11 +1327,6 @@ static void _request_handler(iotcon_resource_h resource, iotcon_request_h reques #ifndef USE_GENLIST elm_list_go(this->info_list); #endif - if (0 != ret) - { - _send_response(request, NULL, IOTCON_RESPONSE_ERROR); - return; - } ret = iotcon_request_get_observe_type(request, &observe_type); if (IOTCON_ERROR_NONE != ret) diff --git a/tbtcoreapp/src/view/tbt-list-view.c b/tbtcoreapp/src/view/tbt-list-view.c index 5cc5149..4ea656d 100644 --- a/tbtcoreapp/src/view/tbt-list-view.c +++ b/tbtcoreapp/src/view/tbt-list-view.c @@ -78,7 +78,7 @@ Evas_Object *tbt_list_view_create(Evas_Object *navi) evas_object_event_callback_add(view->list, EVAS_CALLBACK_FREE, _list_view_destroy_cb, view); view->navi_item = elm_naviframe_item_push(view->navi, "TBT", NULL, NULL, view->list, NULL); - RETVM_IF(!view->navi_item, NULL, "elm_naviframe_item_push failed"); + RETVM_IF_CLEANUP(!view->navi_item, NULL,"elm_naviframe_item_push failed",SAFE_DELETE(view)); return view->list; } diff --git a/tbtcoreapp/src/view/tbt-local-view.c b/tbtcoreapp/src/view/tbt-local-view.c index 7645ffe..c21e44f 100644 --- a/tbtcoreapp/src/view/tbt-local-view.c +++ b/tbtcoreapp/src/view/tbt-local-view.c @@ -368,7 +368,9 @@ static player_h create_player(local_view *this) RETVM_IF(result != PLAYER_ERROR_NONE, NULL, "player_set_volume fail > Error = %s", get_local_view_error(result)); result = player_set_looping(player, true); RETVM_IF(result != PLAYER_ERROR_NONE, NULL, "player_set_looping fail > Error = %s", get_local_view_error(result)); - result = player_set_uri(player, get_resource_path(this->view->tbt_info->file_name)); + char *path= get_resource_path(this->view->tbt_info->file_name); + result = player_set_uri(player, path); + SAFE_DELETE(path); RETVM_IF(result != PLAYER_ERROR_NONE, NULL, "player_set_uri fail > Error = %s", get_local_view_error(result)); #ifdef DEVICE_TYPE_MOBILE result = player_set_display(player, PLAYER_DISPLAY_TYPE_EVAS, GET_DISPLAY(this->video_rect)); diff --git a/tbtcoreapp/src/view/tbt-media-key-view.c b/tbtcoreapp/src/view/tbt-media-key-view.c index 9f16bae..c866694 100644 --- a/tbtcoreapp/src/view/tbt-media-key-view.c +++ b/tbtcoreapp/src/view/tbt-media-key-view.c @@ -158,7 +158,7 @@ static void _media_key_event_cb(media_key_e key, media_key_event_e status, void RETM_IF(NULL == this, "view is NULL"); DBG("value: %d", status); - + ui_utils_label_set_text(this->mediakey_label, "unknown state", "left"); switch (status) { case MEDIA_KEY_STATUS_PRESSED: @@ -170,11 +170,9 @@ static void _media_key_event_cb(media_key_e key, media_key_event_e status, void case MEDIA_KEY_STATUS_UNKNOWN: ui_utils_label_set_text(this->mediakey_label, "Unknown status", "left"); break; - default: - ui_utils_label_set_text(this->mediakey_label, "unknown state", "left"); - break; } - + + ui_utils_label_set_text(this->mediakey2_label, "unknown state", "left"); DBG("value: %d", key); switch (key) { @@ -208,9 +206,6 @@ static void _media_key_event_cb(media_key_e key, media_key_event_e status, void case MEDIA_KEY_UNKNOWN: ui_utils_label_set_text(this->mediakey2_label, "Unknown key", "left"); break; - default: - ui_utils_label_set_text(this->mediakey_label, "unknown state", "left"); - break; } return ; } diff --git a/tbtcoreapp/src/view/tbt-motion-detection-view.c b/tbtcoreapp/src/view/tbt-motion-detection-view.c index 4445408..84c43a2 100644 --- a/tbtcoreapp/src/view/tbt-motion-detection-view.c +++ b/tbtcoreapp/src/view/tbt-motion-detection-view.c @@ -102,8 +102,8 @@ motion_detection_view *motion_detection_view_add(Evas_Object *navi, tbt_info *tb const char *file_path; file_path = get_resource_path(this->view->tbt_info->file_name); this->activity_image = ui_utils_create_image(this->view->layout, file_path); + SAFE_DELETE(file_path); - //int x,y,w,h; evas_object_geometry_get(this->activity_image, &x, &y, &w, &h); DBG("Dim: %d %d %d %d", x, y, w, h); @@ -229,7 +229,9 @@ static void _start_detection_button_pressed_cb(void *data, Evas_Object *obj, voi elm_naviframe_item_pop(this->view->navi); activity_stop_recognition(this->handle); activity_release(this->handle); - RETM_IF(nRet != ACTIVITY_ERROR_NONE, "activity_start_recognition failed for activity type = %s",_motion_get_activity_type(activity_type)); + char * error_string = _motion_get_activity_type(activity_type); + RETM_IF_CLEANUP(nRet != ACTIVITY_ERROR_NONE, "activity_start_recognition failed for activity type = %s", SAFE_DELETE(error_string), error_string); + SAFE_DELETE(error_string); } } @@ -248,7 +250,10 @@ static void activity_recognition_callback_check_type(activity_type_e activity, c DBG("activity_recognition_callback_check_type"); RETM_IF(NULL == user_data, "User data is NULL"); motion_detection_view *this = (motion_detection_view*)user_data; - snprintf(label, sizeof(label), "%s : %s" , "Activity Status is : ", _motion_get_activity_type(activity)); + char* error_string = NULL; + error_string = _motion_get_activity_type(activity); + snprintf(label, sizeof(label), "%s : %s" , "Activity Status is : ", error_string); + SAFE_DELETE(error_string); ui_utils_label_set_text(this->activity_label, label, "left"); return; } diff --git a/tbtcoreapp/src/view/tbt-mtp-view.c b/tbtcoreapp/src/view/tbt-mtp-view.c index 450447b..dc6b8f8 100644 --- a/tbtcoreapp/src/view/tbt-mtp-view.c +++ b/tbtcoreapp/src/view/tbt-mtp-view.c @@ -241,7 +241,9 @@ static void mtp_functions(mtp_view *this) mtp_object_h *folder_list2; int folder_count2; res = mtp_get_object_handles(this->mtp_devices[i], this->mtp_storages[j], MTP_FILETYPE_FOLDER, folder_list[k], &folder_list2, &folder_count2); + RETM_IF(res != MTP_ERROR_NONE, "mtp_get_object_handles > Error = %s", get_mtp_info_error(res)); res = mtp_get_object_handles(this->mtp_devices[i], this->mtp_storages[j], MTP_FILETYPE_JPEG, folder_list2[folder_count2 >0 ? folder_count2-1:0], &this->file_list, &file_count); + RETM_IF(res != MTP_ERROR_NONE, "mtp_get_object_handles > Error = %s", get_mtp_info_error(res)); char* folder_name2; mtp_objectinfo_get_file_name(this->mtp_devices[i], folder_list2[folder_count2 >0 ? folder_count2-1:0], &folder_name2); @@ -262,6 +264,7 @@ static void mtp_functions(mtp_view *this) for (k = 0; k < file_count; k++) { mtp_data *data = (mtp_data*) malloc(sizeof(mtp_data)); + RETM_IF(data == NULL,"data is null"); deallocate_me[count++] = data; @@ -397,7 +400,7 @@ static char* get_mtp_info_error(mtp_error_e err_code) static char* get_mtp_storage_type(mtp_storage_type_e type_e) { - char* type_str; + char* type_str="Unknown Type"; switch(type_e){ case MTP_STORAGE_TYPE_UNDEFINED: type_str = "MTP_STORAGE_TYPE_UNDEFINED"; @@ -419,9 +422,6 @@ static char* get_mtp_storage_type(mtp_storage_type_e type_e) type_str = "MTP_STORAGE_TYPE_REMOVABLE_RAM"; break; - default: - type_str = "Unknown Type"; - break; } return type_str; @@ -533,16 +533,17 @@ static void _image_file_list_item_clicked(void *data, Evas_Object *obj, void *ev DBG("Image Path %s", image_path); res = mtp_get_object(device_handle, file_handle, image_path); - RETM_IF(res != MTP_ERROR_NONE, "mtp_get_object fail > Error = %s", get_mtp_info_error(res)); + RETM_IF_CLEANUP(res != MTP_ERROR_NONE, "mtp_get_object fail > Error = %s", SAFE_DELETE(image_path), get_mtp_info_error(res)); Evas_Object* image = ui_utils_create_image(this->view->layout, image_path); + SAFE_DELETE(image_path); elm_object_part_content_set(this->view->layout, "mtp_image_view", image); } static char* get_mtp_file_type_str(mtp_filetype_e file_type){ - char* type_str; + char* type_str = "Unknown Type"; switch (file_type) { case MTP_FILETYPE_FOLDER: type_str = "MTP_FILETYPE_FOLDER"; @@ -685,9 +686,6 @@ static char* get_mtp_file_type_str(mtp_filetype_e file_type){ case MTP_FILETYPE_ALL_IMAGE: type_str = "MTP_FILETYPE_ALL_IMAGE"; break; - default: - type_str = "Unknown Type"; - break; } return type_str; diff --git a/tbtcoreapp/src/view/tbt-nfc-view.c b/tbtcoreapp/src/view/tbt-nfc-view.c index 883db67..89c8878 100644 --- a/tbtcoreapp/src/view/tbt-nfc-view.c +++ b/tbtcoreapp/src/view/tbt-nfc-view.c @@ -270,27 +270,52 @@ int nfc_onoff_operation(void) { int ret = 0; app_control_h service = NULL; - app_control_create(&service); + ret = app_control_create(&service); + if ( ret != APP_CONTROL_ERROR_NONE) + { + DBG("app_control_create failed!"); + return -1; + } if (service == NULL) { DBG("service_create failed!"); - return 0; + return -1; + } + ret = app_control_set_operation(service, "http://tizen.org/appcontrol/operation/setting/nfc"); + if ( ret != APP_CONTROL_ERROR_NONE) + { + DBG("app_control_set_operation failed!"); + return -1; + } + ret = app_control_add_extra_data(service, "type", "nfc"); + if ( ret != APP_CONTROL_ERROR_NONE) + { + DBG("app_control_add_extra_data failed!"); + return -1; } - app_control_set_operation(service, "http://tizen.org/appcontrol/operation/setting/nfc"); - app_control_add_extra_data(service, "type", "nfc"); ret = app_control_send_launch_request(service, NULL, NULL); - - app_control_destroy(service); if (ret == APP_CONTROL_ERROR_NONE) { DBG("Succeeded to NFC On/Off app!"); - return 0; } else { DBG("Failed to relaunch NFC On/Off app!"); - return -1; + ret = app_control_destroy(service); + if (ret != APP_CONTROL_ERROR_NONE) + { + DBG("app_control_destroy Fail"); + } + return -1; } + + ret = app_control_destroy(service); + if (ret != APP_CONTROL_ERROR_NONE) + { + DBG("app_control_destroy Fail"); + return -1; + } + return 0; } @@ -893,7 +918,7 @@ void _nfc_p2p_data_received_cb(nfc_p2p_target_h target, nfc_ndef_message_h messa */ static char* get_nfc_tag_name(nfc_tag_type_e type) { - char* type_name; + char* type_name = "UNKNOWN_TYPE"; switch(type) { @@ -958,10 +983,6 @@ switch(type) case NFC_NFCIP1_INITIATOR: type_name = "NFC_NFCIP1_INITIATOR"; break; - default: - type_name = "UNKNOWN_TYPE"; - break; - } return type_name; } @@ -1396,10 +1417,6 @@ void _nfc_tag_read_completed_cb(nfc_error_e result, nfc_ndef_message_h message, this = (nfc_view*)user_data; RETM_IF(NULL == this, "view is NULL"); - if(result != NFC_ERROR_NONE) - { - ui_utils_show_toast(get_nfc_string_error(result), this->view->layout, 3); - } ret = nfc_ndef_message_get_record_count(message, &count); RETM_IF(ret != NFC_ERROR_NONE, "nfc_ndef_message_get_record_count failed with error: %s", get_nfc_error(ret)); diff --git a/tbtcoreapp/src/view/tbt-nsd-dns-sd-view.c b/tbtcoreapp/src/view/tbt-nsd-dns-sd-view.c index fbb0989..329a5b2 100644 --- a/tbtcoreapp/src/view/tbt-nsd-dns-sd-view.c +++ b/tbtcoreapp/src/view/tbt-nsd-dns-sd-view.c @@ -190,7 +190,7 @@ static void _dnssd_found_cb(dnssd_service_state_e service_state, dnssd_service_h res = dnssd_service_get_name(remote_service, &service_name); RETM_IF(res != DNSSD_ERROR_NONE, "dnssd_service_get_name fail > Error = %s", get_dns_sd_error(res)); - if(service_name != NULL && sizeof(service_name) >0) + if(service_name != NULL) { str = format_string("service name: %s", service_name); elm_list_item_append(this->list, str, NULL, NULL, NULL, NULL); @@ -200,7 +200,7 @@ static void _dnssd_found_cb(dnssd_service_state_e service_state, dnssd_service_h res = dnssd_service_get_type(remote_service, &service_type); RETM_IF(res != DNSSD_ERROR_NONE, "dnssd_service_get_type fail > Error = %s", get_dns_sd_error(res)); - if(service_type != NULL && sizeof(service_type) >0) + if(service_type != NULL) { str = format_string("service type: %s", service_type); elm_list_item_append(this->list, str, NULL, NULL, NULL, NULL); @@ -210,13 +210,13 @@ static void _dnssd_found_cb(dnssd_service_state_e service_state, dnssd_service_h res = dnssd_service_get_ip(remote_service, &ipv4, &ipv6); RETM_IF(res != DNSSD_ERROR_NONE, "dnssd_service_get_ip fail > Error = %s", get_dns_sd_error(res)); - if(ipv4 != NULL && sizeof(ipv4) >0) + if(ipv4 != NULL) { str = format_string("ipv4: %s", ipv4); elm_list_item_append(this->list, str, NULL, NULL, NULL, NULL); SAFE_DELETE(str); } - if(ipv6 != NULL && sizeof(ipv6) >0) + if(ipv6 != NULL) { str = format_string("ipv6: %s", ipv6); elm_list_item_append(this->list, str, NULL, NULL, NULL, NULL); @@ -396,6 +396,7 @@ static void _app_destroy_cb(void* this) RETM_IF(res != DNSSD_ERROR_NONE, "dnssd_destroy_local_service fail > Error = %s", get_dns_sd_error(res)); res = dnssd_service_unset_record(view->dnssd_local_service, 16); + RETM_IF(res != DNSSD_ERROR_NONE, "dnssd_service_unset_record > Error = %s", get_dns_sd_error(res)); } if(view->is_btn_browse_clicked == true) @@ -490,12 +491,19 @@ static char** str_split(char* a_str, const char a_delim) { size_t idx = 0; char* token = strtok(a_str, delim); + RETVM_IF(token == NULL, NULL,"strtok failed"); while (token) { - RETVM_IF(idx >= count, NULL, "idx >= count"); - *(result + idx++) = strdup(token); - token = strtok(0, delim); + if(idx < count) + { + *(result + idx++) = strdup(token); + token = strtok(0, delim); + } + else + { + break; + } } *(result + idx) = 0; } diff --git a/tbtcoreapp/src/view/tbt-oauth2-view.c b/tbtcoreapp/src/view/tbt-oauth2-view.c index 6c0c5d3..8239628 100644 --- a/tbtcoreapp/src/view/tbt-oauth2-view.c +++ b/tbtcoreapp/src/view/tbt-oauth2-view.c @@ -604,7 +604,8 @@ static void parse_json_data(char* json_data, void* user_data) RETM_IF(NULL == a, "a is NULL"); DBG("strip json: %s", a); parser = json_parser_new(); - RETM_IF(NULL == parser, "parser is NULL"); + RETM_IF_CLEANUP(NULL == parser, "parser is NULL",SAFE_DELETE(a)); + gboolean result = json_parser_load_from_data(parser, a, strlen(a), &error); //DBG("json_parser_load_from_data error = %s", (char*)error->message); if(result) @@ -634,7 +635,7 @@ static void parse_json_data(char* json_data, void* user_data) this->google_pic = picture; this->google_gender = gender; } - + SAFE_DELETE(a); } diff --git a/tbtcoreapp/src/view/tbt-package-manager-view.c b/tbtcoreapp/src/view/tbt-package-manager-view.c index f890912..50afd71 100644 --- a/tbtcoreapp/src/view/tbt-package-manager-view.c +++ b/tbtcoreapp/src/view/tbt-package-manager-view.c @@ -172,6 +172,7 @@ static void _package_manager_event_cb(const char *type, const char *package, pac RETM_IF(NULL == this, "view is NULL"); DBG("value: %d", event_type); + ui_utils_label_set_text(this->packagemanager_label, "unknown state", "left"); switch (event_type) { @@ -184,10 +185,10 @@ static void _package_manager_event_cb(const char *type, const char *package, pac case PACKAGE_MANAGER_EVENT_TYPE_UPDATE: ui_utils_label_set_text(this->packagemanager_label, "Update event type", "left"); break; - default: - ui_utils_label_set_text(this->packagemanager_label, "unknown state", "left"); - break; + } + + ui_utils_label_set_text(this->packagemanagerstate_label, "unknown state", "left"); switch(event_state) { case PACKAGE_MANAGER_EVENT_STATE_STARTED: @@ -202,9 +203,6 @@ static void _package_manager_event_cb(const char *type, const char *package, pac case PACKAGE_MANAGER_EVENT_STATE_FAILED: ui_utils_label_set_text(this->packagemanagerstate_label, "Failed event state", "left"); break; - default: - ui_utils_label_set_text(this->packagemanagerstate_label, "unknown state", "left"); - break; } return ; } diff --git a/tbtcoreapp/src/view/tbt-pick-view.c b/tbtcoreapp/src/view/tbt-pick-view.c index f3d04a2..f31e1df 100644 --- a/tbtcoreapp/src/view/tbt-pick-view.c +++ b/tbtcoreapp/src/view/tbt-pick-view.c @@ -326,6 +326,8 @@ static void _add_urls_all(pick_view *this) Elm_Object_Item* it; this->all = (view_item*)malloc(sizeof(view_item)); + RETM_IF(this->all == NULL, "malloc failed"); + this->all->uri = NULL; this->all->mime = "*/*"; it = elm_list_item_append(this->data_list, "All", NULL, NULL, _view, this->all); @@ -340,6 +342,7 @@ static void _add_urls_image(pick_view *this) Elm_Object_Item* it; this->image = (view_item*)malloc(sizeof(view_item)); + RETM_IF(this->image == NULL, "malloc failed"); this->image->uri = NULL; this->image->mime = "image/*"; it = elm_list_item_append(this->data_list, "Image", NULL, NULL, _view, this->image); @@ -354,6 +357,7 @@ static void _add_urls_video(pick_view *this) Elm_Object_Item* it; this->video = (view_item*)malloc(sizeof(view_item)); + RETM_IF(this->video == NULL, "malloc failed"); this->video->uri = NULL; this->video->mime = "video/*"; it = elm_list_item_append(this->data_list, "Video", NULL, NULL, _view, this->video); @@ -368,6 +372,7 @@ static void _add_urls_audio(pick_view *this) Elm_Object_Item* it; this->audio = (view_item*)malloc(sizeof(view_item)); + RETM_IF(this->audio == NULL, "malloc failed"); this->audio->uri = NULL; this->audio->mime = "audio/*"; it = elm_list_item_append(this->data_list, "Audio", NULL, NULL, _view, this->audio); @@ -388,11 +393,13 @@ static void _add_urls(pick_view *this) { this->http = (view_item*)malloc(sizeof(view_item)); + RETM_IF(this->http == NULL, "malloc failed"); this->http->uri = PICK_VIEW_URL_HTTP; this->http->mime = NULL; it = elm_list_item_append(this->data_list, PICK_VIEW_URL_HTTP, NULL, NULL, _view, this->http); this->https = (view_item*)malloc(sizeof(view_item)); + RETM_IF(this->https == NULL, "malloc failed"); this->https->uri = PICK_VIEW_URL_HTTPS; this->https->mime = NULL; it = elm_list_item_append(this->data_list, PICK_VIEW_URL_HTTPS, NULL, NULL, _view, this->https); @@ -405,21 +412,25 @@ static void _add_urls(pick_view *this) { this->all = (view_item*)malloc(sizeof(view_item)); + RETM_IF(this->all == NULL, "malloc failed"); this->all->uri = NULL; this->all->mime = "*/*"; it = elm_list_item_append(this->data_list, "All", NULL, NULL, _view, this->all); this->image = (view_item*)malloc(sizeof(view_item)); + RETM_IF(this->image == NULL, "malloc failed"); this->image->uri = NULL; this->image->mime = "image/*"; it = elm_list_item_append(this->data_list, "Image", NULL, NULL, _view, this->image); this->video = (view_item*)malloc(sizeof(view_item)); + RETM_IF(this->video == NULL, "malloc failed"); this->video->uri = NULL; this->video->mime = "video/*"; it = elm_list_item_append(this->data_list, "Video", NULL, NULL, _view, this->video); this->audio = (view_item*)malloc(sizeof(view_item)); + RETM_IF(this->audio == NULL, "malloc failed"); this->audio->uri = NULL; this->audio->mime = "audio/*"; it = elm_list_item_append(this->data_list, "Audio", NULL, NULL, _view, this->audio); @@ -436,6 +447,7 @@ static void _add_images(pick_view *this) //elm_list_clear(this->data_list); this->bmp = (view_item*)malloc(sizeof(view_item)); + RETM_IF(this->bmp == NULL, "malloc failed"); this->bmp->uri = format_string("file://%s%s", this->shared_res_path, PICK_VIEW_IMAGE_BMP); DBG("PICK_VIEW_IMAGE_BMP:%s", this->bmp->uri); this->bmp->mime = "image/bmp"; @@ -443,6 +455,7 @@ static void _add_images(pick_view *this) //elm_object_item_data_set(it, "image/bmp"); this->jpg = (view_item*)malloc(sizeof(view_item)); + RETM_IF(this->jpg == NULL, "malloc failed"); this->jpg->uri = format_string("file://%s%s", this->shared_res_path, PICK_VIEW_IMAGE_JPG); DBG("PICK_VIEW_IMAGE_JPG:%s", this->jpg->uri); this->jpg->mime = "image/jpeg"; @@ -450,6 +463,7 @@ static void _add_images(pick_view *this) //elm_object_item_data_set(it, "image/jpeg"); this->gif = (view_item*)malloc(sizeof(view_item)); + RETM_IF(this->gif == NULL, "malloc failed"); this->gif->uri = format_string("file://%s%s", this->shared_res_path, PICK_VIEW_IMAGE_GIF); DBG("PICK_VIEW_IMAGE_GIF:%s", this->gif->uri); this->gif->mime = "image/gif"; @@ -457,6 +471,7 @@ static void _add_images(pick_view *this) //elm_object_item_data_set(it, "image/gif"); this->png = (view_item*)malloc(sizeof(view_item)); + RETM_IF(this->png == NULL, "malloc failed"); this->png->uri = format_string("file://%s%s", this->shared_res_path, PICK_VIEW_IMAGE_PNG); DBG("PICK_VIEW_IMAGE_PNG:%s", this->png->uri); this->png->mime = "image/png"; @@ -474,6 +489,7 @@ static void _add_sounds(pick_view *this) //elm_list_clear(this->data_list); this->aac = (view_item*)malloc(sizeof(view_item)); + RETM_IF(this->aac == NULL, "malloc failed"); this->aac->uri = format_string("file://%s%s", this->shared_res_path, PICK_VIEW_SOUND_AAC); DBG("PICK_VIEW_SOUND_AAC:%s", this->aac->uri); this->aac->mime = "audio/aac"; @@ -481,6 +497,7 @@ static void _add_sounds(pick_view *this) //elm_object_item_data_set(it, "image/bmp"); this->amr = (view_item*)malloc(sizeof(view_item)); + RETM_IF(this->amr == NULL, "malloc failed"); this->amr->uri = format_string("file://%s%s", this->shared_res_path, PICK_VIEW_SOUND_AMR); DBG("PICK_VIEW_SOUND_AMR:%s", this->amr->uri); this->amr->mime = "audio/amr"; @@ -488,6 +505,7 @@ static void _add_sounds(pick_view *this) //elm_object_item_data_set(it, "image/jpeg"); this->mp3 = (view_item*)malloc(sizeof(view_item)); + RETM_IF(this->mp3 == NULL, "malloc failed"); this->mp3->uri = format_string("file://%s%s", this->shared_res_path, PICK_VIEW_SOUND_MP3); DBG("PICK_VIEW_SOUND_MP3:%s", this->mp3->uri); this->mp3->mime = "audio/mp3"; @@ -495,6 +513,7 @@ static void _add_sounds(pick_view *this) //elm_object_item_data_set(it, "image/gif"); this->wav = (view_item*)malloc(sizeof(view_item)); + RETM_IF(this->wav == NULL, "malloc failed"); this->wav->uri = format_string("file://%s%s", this->shared_res_path, PICK_VIEW_SOUND_WAV); DBG("PICK_VIEW_SOUND_WAV:%s", this->wav->uri); this->wav->mime = "audio/wav"; @@ -512,6 +531,7 @@ static void _add_videos(pick_view *this) //elm_list_clear(this->data_list); this->gp3 = (view_item*)malloc(sizeof(view_item)); + RETM_IF(this->gp3 == NULL, "malloc failed"); this->gp3->uri = format_string("file://%s%s", this->shared_res_path, PICK_VIEW_VIDEO_3GP); DBG("PICK_VIEW_VIDEO_3GP:%s", this->gp3->uri); this->gp3->mime = "video/3gpp"; @@ -519,6 +539,7 @@ static void _add_videos(pick_view *this) //elm_object_item_data_set(it, "image/bmp"); this->mp4 = (view_item*)malloc(sizeof(view_item)); + RETM_IF(this->mp4 == NULL, "malloc failed"); this->mp4->uri = format_string("file://%s%s", this->shared_res_path, PICK_VIEW_VIDEO_MP4); DBG("PICK_VIEW_VIDEO_MP4:%s", this->mp4->uri); this->mp4->mime = "video/mp4"; diff --git a/tbtcoreapp/src/view/tbt-push-view.c b/tbtcoreapp/src/view/tbt-push-view.c index c1cd2a4..ae76a0d 100644 --- a/tbtcoreapp/src/view/tbt-push-view.c +++ b/tbtcoreapp/src/view/tbt-push-view.c @@ -328,8 +328,8 @@ static void on_app_resume_cb(void* data) static char* get_xml_element_value (xmlDocPtr doc, xmlNodePtr cur, const char* tag) { - xmlChar *key; - char* str; + xmlChar *key = NULL; + char* str = NULL; cur = cur->xmlChildrenNode; while (cur != NULL) { if ((!xmlStrcmp(cur->name, (const xmlChar *)tag))) { @@ -345,21 +345,31 @@ static char* get_xml_element_value (xmlDocPtr doc, xmlNodePtr cur, const char* t static void create_notification_template() { - - DBG("TEST %s", get_shared_resource_path("test.wav")); + char *resource_path = NULL; + resource_path = get_shared_resource_path("test.wav"); + DBG("TEST %s", resource_path); + SAFE_DELETE(resource_path); notification_h n = NULL; n = notification_create(NOTIFICATION_TYPE_NOTI); + notification_set_text(n, NOTIFICATION_TEXT_TYPE_TITLE, "template title", NULL, NOTIFICATION_TEXT_TYPE_NONE); + notification_set_text(n, NOTIFICATION_TEXT_TYPE_CONTENT, "template content", NULL, NOTIFICATION_TEXT_TYPE_NONE); + + resource_path = get_shared_resource_path("test.wav"); + notification_set_sound(n, NOTIFICATION_SOUND_TYPE_USER_DATA, resource_path); + SAFE_DELETE(resource_path); + + resource_path = get_shared_resource_path("icon.png"); + notification_set_image(n, NOTIFICATION_IMAGE_TYPE_ICON, resource_path); + SAFE_DELETE(resource_path); - notification_set_text(n, NOTIFICATION_TEXT_TYPE_TITLE, "template title", NULL, NOTIFICATION_TEXT_TYPE_NONE); - notification_set_text(n, NOTIFICATION_TEXT_TYPE_CONTENT, "template content", NULL, NOTIFICATION_TEXT_TYPE_NONE); - notification_set_sound(n, NOTIFICATION_SOUND_TYPE_USER_DATA, get_shared_resource_path("test.wav")); - notification_set_image(n, NOTIFICATION_IMAGE_TYPE_ICON, get_shared_resource_path("icon.png")); - notification_set_image(n, NOTIFICATION_IMAGE_TYPE_BACKGROUND, get_shared_resource_path("background.png")); - notification_save_as_template(n, "template_test"); + resource_path = get_shared_resource_path("background.png"); + notification_set_image(n, NOTIFICATION_IMAGE_TYPE_BACKGROUND, resource_path); + SAFE_DELETE(resource_path); - notification_free(n); + notification_save_as_template(n, "template_test"); + notification_free(n); } /** @@ -825,6 +835,8 @@ create_list_view(void* user_data) int i = 0; for (i = 0; i < message_length; i++) { id = calloc(sizeof(item_data_s), 1); + RETM_IF(id == NULL,"id is null"); + id->index = i; /* Append genlist item for list */ id->item = elm_genlist_item_append(genlist, itc, id, NULL, ELM_GENLIST_ITEM_NONE, NULL, this); @@ -992,19 +1004,17 @@ static void send_push_data_to_server(void* user_data) // adding header curl_err = curl_easy_setopt(this->curl_handle, CURLOPT_HTTPHEADER, header_list); - RETM_IF(curl_err != CURLE_OK, "curl_easy_setopt - Adding header_list Failed %d", curl_err); + RETM_IF_CLEANUP(curl_err != CURLE_OK, "curl_easy_setopt - Adding header_list Failed %d", SAFE_DELETE(post_data), curl_err); // adding body/post curl_err = curl_easy_setopt(this->curl_handle, CURLOPT_POSTFIELDS, post_data); - RETM_IF(curl_err != CURLE_OK, "curl_easy_setopt - Adding post_data Failed %d", curl_err); - - + RETM_IF_CLEANUP(curl_err != CURLE_OK, "curl_easy_setopt - Adding post_data Failed %d", SAFE_DELETE(post_data), curl_err); char* server = push_service_get_server_address(this->reg_id); DBG("Server Address: %s", server); curl_err = curl_easy_setopt(this->curl_handle, CURLOPT_URL, server); - RETM_IF(curl_err != CURLE_OK, "curl_easy_setopt - Adding CURLOPT_URL Failed %d", curl_err); + RETM_IF_CLEANUP(curl_err != CURLE_OK, "curl_easy_setopt - Adding CURLOPT_URL Failed %d", SAFE_DELETE(post_data), curl_err); curl_easy_setopt(this->curl_handle, CURLOPT_SSL_VERIFYPEER, 0L); curl_easy_setopt(this->curl_handle, CURLOPT_WRITEFUNCTION, _curl_response_cb); @@ -1015,6 +1025,7 @@ static void send_push_data_to_server(void* user_data) ret = connection_create(&connection); if (CONNECTION_ERROR_NONE != ret) { DBG("fail to create conn_handle[%d]", ret); + SAFE_DELETE(post_data); return; } diff --git a/tbtcoreapp/src/view/tbt-sensor-view.c b/tbtcoreapp/src/view/tbt-sensor-view.c index ab0a1d0..e12a168 100755 --- a/tbtcoreapp/src/view/tbt-sensor-view.c +++ b/tbtcoreapp/src/view/tbt-sensor-view.c @@ -736,12 +736,14 @@ static void genlist_sensor_value_items_update(sensor_view *view, float *values) DBG("Distance: %f %f %f ", distance, SENSOR_PROXIMITY_NEAR, SENSOR_PROXIMITY_FAR); if(values[0] == 0.0f) { - const char *file_path; + const char *file_path = NULL; file_path = get_resource_path(view->view->tbt_info->file_name); view->proximity_off_image = ui_utils_create_image(view->view->layout, file_path); - RETM_IF(NULL == view->proximity_off_image, "create of proximity_on_image failed"); + RETM_IF_CLEANUP(NULL == view->proximity_off_image, "create of proximity_on_image failed", SAFE_DELETE(file_path)); + DBG("File loaded successfull"); + SAFE_DELETE(file_path); elm_object_part_content_set(view->view->layout, "image_view", view->proximity_off_image); @@ -749,12 +751,14 @@ static void genlist_sensor_value_items_update(sensor_view *view, float *values) if (values[0] >= 1.0f) { - const char *file_path; + const char *file_path = NULL; file_path = get_resource_path(view->view->tbt_info->extra_file_name); view->proximity_on_image = ui_utils_create_image(view->view->layout, file_path); - RETM_IF(NULL == view->proximity_on_image, "create of proximity_on_image failed"); + RETM_IF_CLEANUP(NULL == view->proximity_on_image, "create of proximity_on_image failed", SAFE_DELETE(file_path)); + DBG("File loaded successfull"); + SAFE_DELETE(file_path); elm_object_part_content_set(view->view->layout, "image_view", view->proximity_on_image); diff --git a/tbtcoreapp/src/view/tbt-shortcut-view.c b/tbtcoreapp/src/view/tbt-shortcut-view.c index d8ed4aa..c66b810 100644 --- a/tbtcoreapp/src/view/tbt-shortcut-view.c +++ b/tbtcoreapp/src/view/tbt-shortcut-view.c @@ -193,6 +193,7 @@ static void _control_button_pressed_cb(void *data, Evas_Object *obj, void *event DBG("icon path = %s",icon); DBG("Inside shortcut_add_to_home %s, allow_duplicate = %d, result = %d, %s", get_shortcut_error(result), allow_duplicate, result, get_error_message(result)); + SAFE_DELETE(icon); } char* get_shortcut_error(int err){ diff --git a/tbtcoreapp/src/view/tbt-sound-manager-view.c b/tbtcoreapp/src/view/tbt-sound-manager-view.c index 48fb7cd..5bca38f 100644 --- a/tbtcoreapp/src/view/tbt-sound-manager-view.c +++ b/tbtcoreapp/src/view/tbt-sound-manager-view.c @@ -233,21 +233,22 @@ void _sound_device_information_changed_cb(sound_device_h device, sound_device_ch soundmanager_view *this = NULL; this = (soundmanager_view*) user_data; + char* status = "Unknown status"; + char* direction = "left"; + DBG("changed_info: %d", changed_info); switch(changed_info) { case SOUND_DEVICE_CHANGED_INFO_STATE : - ui_utils_label_set_text(this->info_label, "State of the device was changed", "left"); + status = "State of the device was changed"; break; case SOUND_DEVICE_CHANGED_INFO_IO_DIRECTION: - ui_utils_label_set_text(this->info_label, "IO direction of the device was changed", "left"); - break; - default: - ui_utils_label_set_text(this->info_label, "Unknown status", "left"); + status = "IO direction of the device was changed"; break; } + ui_utils_label_set_text(this->info_label, status, direction); } diff --git a/tbtcoreapp/src/view/tbt-sound-view.c b/tbtcoreapp/src/view/tbt-sound-view.c index f9d41dd..341ec93 100644 --- a/tbtcoreapp/src/view/tbt-sound-view.c +++ b/tbtcoreapp/src/view/tbt-sound-view.c @@ -283,8 +283,12 @@ sound_view *sound_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_Ite RETVM_IF(!this, NULL, "calloc failed"); RETVM_IF(NULL == this->view, NULL, "navi is null"); - this->audio_icon = ui_utils_create_image(this->view->layout, get_resource_path("images/audio-icon.png")); - RETVM_IF(NULL == this->audio_icon, false, "create of layout elements failed"); + char* image_path = NULL; + image_path = get_resource_path("images/audio-icon.png"); + this->audio_icon = ui_utils_create_image(this->view->layout, image_path); + RETVM_IF_CLEANUP(NULL == this->audio_icon, false, "create of layout elements failed", SAFE_DELETE(image_path)); + SAFE_DELETE(image_path); + elm_object_part_content_set(this->view->layout, "icon_view", this->audio_icon); if(this->view->tbt_info->apptype == TBT_APP_SOUND_VOLUME) @@ -455,6 +459,7 @@ static player_h create_player(sound_view *this) player_h player = NULL; int ret ; + char* file_path = NULL; ret = player_create(&player); RETVM_IF(ret != PLAYER_ERROR_NONE, NULL, "player_create fail > Error = %s", get_player_error(ret)); @@ -484,7 +489,10 @@ static player_h create_player(sound_view *this) DBG( "player_set_looping fail > Error = %s", get_player_error(ret)); } - ret = player_set_uri(player, get_resource_path(this->view->tbt_info->file_name)); + file_path = get_resource_path(this->view->tbt_info->file_name); + ret = player_set_uri(player, file_path); + SAFE_DELETE(file_path); + if(ret != PLAYER_ERROR_NONE) { DBG( "player_set_uri fail > Error = %s", get_player_error(ret)); @@ -631,7 +639,8 @@ static void _slider_drag_stop_cb(void *data, Evas_Object *obj, void *event_info) RETM_IF(NULL == view, "view is NULL"); double val = elm_slider_value_get(obj); - player_set_volume(view->player, val, val); + int ret = player_set_volume(view->player, val, val); + RETM_IF(ret != PLAYER_ERROR_NONE, "player_set_volume fail > Error = %s", get_player_error(ret)); } diff --git a/tbtcoreapp/src/view/tbt-stt-view.c b/tbtcoreapp/src/view/tbt-stt-view.c index 5131114..42981ab 100644 --- a/tbtcoreapp/src/view/tbt-stt-view.c +++ b/tbtcoreapp/src/view/tbt-stt-view.c @@ -362,7 +362,7 @@ return err_msg; static char* get_stt_state_str(stt_state_e state) { - char* state_str; + char* state_str = "UNKNOWN_STATE"; switch (state) { case STT_STATE_CREATED: @@ -377,10 +377,7 @@ static char* get_stt_state_str(stt_state_e state) case STT_STATE_PROCESSING: state_str = "STT_STATE_PROCESSING"; break; - default: - state_str = "UNKNOWN_STATE"; - break; - } + } return state_str; } diff --git a/tbtcoreapp/src/view/tbt-systemsettings-view.c b/tbtcoreapp/src/view/tbt-systemsettings-view.c index a77476f..a9e9127 100755 --- a/tbtcoreapp/src/view/tbt-systemsettings-view.c +++ b/tbtcoreapp/src/view/tbt-systemsettings-view.c @@ -106,9 +106,10 @@ char* get_system_settings_error(int ret) systemsettings_view *systemsettings_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_Item *item) { RETVM_IF(NULL == navi, NULL, "navi is null"); - int ret, value; + int ret, value = -1; int timevalue = 0; - bool bvalue; + bool bvalue = false; + systemsettings_view *this = NULL; this = calloc(1, sizeof(systemsettings_view)); RETVM_IF(!this, NULL, "calloc failed"); diff --git a/tbtcoreapp/src/view/tbt-tts-view.c b/tbtcoreapp/src/view/tbt-tts-view.c index d9cdbe8..0395350 100644 --- a/tbtcoreapp/src/view/tbt-tts-view.c +++ b/tbtcoreapp/src/view/tbt-tts-view.c @@ -162,8 +162,8 @@ static void _tts_utterance_completed_cb(tts_h tts, int utt_id, void *user_data) static char* get_tts_state_str(tts_state_e state) { + char* state_str = "UNKNOWN_STATE"; - char* state_str; switch(state) { case TTS_STATE_CREATED: @@ -178,12 +178,10 @@ static char* get_tts_state_str(tts_state_e state) case TTS_STATE_PAUSED: state_str = "TTS_STATE_PAUSED"; break; - default: - state_str = "UNKNOWN_STATE"; - break; } return state_str; } + static void _btn_tts_pressed_cb(void *data, Evas_Object *obj, void *event_info) { DBG("_btn_tts_pressed_cb"); diff --git a/tbtcoreapp/src/view/tbt-ui-view.c b/tbtcoreapp/src/view/tbt-ui-view.c index 21a2b21..5940ddd 100644 --- a/tbtcoreapp/src/view/tbt-ui-view.c +++ b/tbtcoreapp/src/view/tbt-ui-view.c @@ -115,8 +115,13 @@ ui_view *ui_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_Item *ite { calc_coordinate(this); + char* file_path = NULL; this->ui_element = elm_image_add(this->view->layout); - elm_image_file_set(this->ui_element, get_resource_path(this->view->tbt_info->file_name), NULL); + + file_path = get_resource_path(this->view->tbt_info->file_name); + elm_image_file_set(this->ui_element, file_path, NULL); + SAFE_DELETE(file_path); + elm_image_no_scale_set(this->ui_element, EINA_TRUE); elm_image_resizable_set(this->ui_element, EINA_TRUE, EINA_TRUE); elm_image_smooth_set(this->ui_element, EINA_FALSE); diff --git a/tbtcoreapp/src/view/tbt-usb-host-view.c b/tbtcoreapp/src/view/tbt-usb-host-view.c index 0584f83..054ef1f 100755 --- a/tbtcoreapp/src/view/tbt-usb-host-view.c +++ b/tbtcoreapp/src/view/tbt-usb-host-view.c @@ -128,7 +128,7 @@ usbhost_view *usbhost_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object 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 = "usb_host_viewer"; tbt_info->layout_file = get_edje_path("usb_host_viewer.edj"); @@ -136,8 +136,6 @@ usbhost_view *usbhost_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object common_view_add(navi, tbt_info, item, this->view, _app_destroy_cb, this); RETVM_IF(NULL == this->view, NULL, "navi is null"); - //ui_utils_guide_instruction_popup_button(navi, "* Please run "devicectl usb-host-test start" or "devicectl usb-host-test stop" command in sdb shell
Note:You can also refer info section
"); - ret = usb_host_create(&hCtxHandle); RETVM_IF(ret != USB_HOST_ERROR_NONE && ret != USB_HOST_ERROR_NOT_SUPPORTED, NULL, "usb_host_create failed : %s", get_usbhost_error(ret)); if(ret == USB_HOST_ERROR_NOT_SUPPORTED)