[SVACE][TBT_M][Fixed SVACE Issues for TBT_M module] 61/150661/5
authorABHISHEK JAIN <j.abhishek@samsung.com>
Mon, 18 Sep 2017 07:24:29 +0000 (12:54 +0530)
committerNibha Sharma <nibha.sharma@samsung.com>
Tue, 19 Sep 2017 04:11:18 +0000 (04:11 +0000)
Signed-off-by: ABHISHEK JAIN <j.abhishek@samsung.com>
Change-Id: I9fddfcf451f2414b28beaea67b6df4531ec901b3

70 files changed:
coretbt_dataprovider/src/coretbt_dataprovider.c
coretbt_uiapp/inc/coretbt_uiapp.h
coretbtwidgetapp/src/coretbtwidgetapp.c
multiclass/src/multiclass.c
operationpickviewapp/src/operationpickviewapp.c
operationpickviewapp/src/videoplayer-util.c
release/binary-armv7l/org.example.multiclass-1.0.0-arm.tpk [changed mode: 0755->0644]
release/binary-armv7l/org.tizen.coretbt_dataprovider-1.0.0-arm.tpk [changed mode: 0755->0644]
release/binary-armv7l/org.tizen.coretbt_serviceapp-1.0.0-arm.tpk [changed mode: 0755->0644]
release/binary-armv7l/org.tizen.coretbt_uiapp-1.0.0-arm.tpk [changed mode: 0755->0644]
release/binary-armv7l/org.tizen.coretbtwidgetapp-1.0.0-arm.tpk [changed mode: 0755->0644]
release/binary-armv7l/org.tizen.operationpickviewapp-1.0.0-arm.tpk [changed mode: 0755->0644]
release/binary-armv7l/org.tizen.tbt-ime-1.0.0-arm.tpk [changed mode: 0755->0644]
release/binary-armv7l/org.tizen.tbt_pushtestapp-1.0.0-arm.tpk [changed mode: 0755->0644]
release/binary-armv7l/org.tizen.tbt_ui_viewmgr-1.0.0-arm.tpk [changed mode: 0755->0644]
release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk
release/binary-armv7l/org.tizen.tbtcoreapp-dali-1.0.0-arm.tpk [changed mode: 0755->0644]
release/binary-x86/org.example.multiclass-1.0.0-x86.tpk [changed mode: 0755->0644]
release/binary-x86/org.tizen.coretbt_dataprovider-1.0.0-x86.tpk [changed mode: 0755->0644]
release/binary-x86/org.tizen.coretbt_serviceapp-1.0.0-x86.tpk [changed mode: 0755->0644]
release/binary-x86/org.tizen.coretbt_uiapp-1.0.0-x86.tpk [changed mode: 0755->0644]
release/binary-x86/org.tizen.coretbtwidgetapp-1.0.0-x86.tpk [changed mode: 0755->0644]
release/binary-x86/org.tizen.operationpickviewapp-1.0.0-x86.tpk [changed mode: 0755->0644]
release/binary-x86/org.tizen.tbt-ime-1.0.0-x86.tpk [changed mode: 0755->0644]
release/binary-x86/org.tizen.tbt_pushtestapp-1.0.0-x86.tpk [changed mode: 0755->0644]
release/binary-x86/org.tizen.tbt_ui_viewmgr-1.0.0-x86.tpk [changed mode: 0755->0644]
release/binary-x86/org.tizen.tbtcoreapp-1.0.0-x86.tpk
release/binary-x86/org.tizen.tbtcoreapp-dali-1.0.0-x86.tpk [changed mode: 0755->0644]
tbt-ime/src/tbt-ime.c
tbt_pushtestapp/src/tbt_pushtestapp.c
tbt_ui_viewmgr/src/view1.c
tbtcoreapp-dali/src/utils/dali-ui-utils.cpp
tbtcoreapp-dali/src/view/tbt-dali-actor-view.cpp
tbtcoreapp-dali/src/view/tbt-dali-stage-view.cpp
tbtcoreapp-dali/src/view/tbt-dali-style-manager-view.cpp
tbtcoreapp-dali/src/view/tbt-dali-touch-data-view.cpp
tbtcoreapp/inc/utils/config.h
tbtcoreapp/inc/utils/logger.h
tbtcoreapp/src/utils/util_state_object.c
tbtcoreapp/src/utils/xml-util.c
tbtcoreapp/src/view/tbt-attachpanel-view.c
tbtcoreapp/src/view/tbt-bluetooth-callback-view.c
tbtcoreapp/src/view/tbt-bluetooth-view.c
tbtcoreapp/src/view/tbt-bluetoothle-view.c
tbtcoreapp/src/view/tbt-camera-view.c
tbtcoreapp/src/view/tbt-connection-view.c
tbtcoreapp/src/view/tbt-dali-view.c
tbtcoreapp/src/view/tbt-datacontrol-view.c
tbtcoreapp/src/view/tbt-image-view.c
tbtcoreapp/src/view/tbt-iotcon-view.c
tbtcoreapp/src/view/tbt-list-view.c
tbtcoreapp/src/view/tbt-local-view.c
tbtcoreapp/src/view/tbt-media-key-view.c
tbtcoreapp/src/view/tbt-motion-detection-view.c
tbtcoreapp/src/view/tbt-mtp-view.c
tbtcoreapp/src/view/tbt-nfc-view.c
tbtcoreapp/src/view/tbt-nsd-dns-sd-view.c
tbtcoreapp/src/view/tbt-oauth2-view.c
tbtcoreapp/src/view/tbt-package-manager-view.c
tbtcoreapp/src/view/tbt-pick-view.c
tbtcoreapp/src/view/tbt-push-view.c
tbtcoreapp/src/view/tbt-sensor-view.c
tbtcoreapp/src/view/tbt-shortcut-view.c
tbtcoreapp/src/view/tbt-sound-manager-view.c
tbtcoreapp/src/view/tbt-sound-view.c
tbtcoreapp/src/view/tbt-stt-view.c
tbtcoreapp/src/view/tbt-systemsettings-view.c
tbtcoreapp/src/view/tbt-tts-view.c
tbtcoreapp/src/view/tbt-ui-view.c
tbtcoreapp/src/view/tbt-usb-host-view.c

index 57feb587d8805c2893f08531d75355a468815f69..d3dabe93d785687ab11da8c7330bdeff93331255 100644 (file)
@@ -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);
index f8bbcab2af479d117cc1cfb70eec1c94e0967974..1d3b51bc33f570b1ea3f48fbace8f682dc9659cc 100644 (file)
@@ -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
index c5ccc9ad3edd8bbeb4cb6a8a5e4f6eb0bda31b7c..a834aed58902b0ef898dff74e15d26e33d2ada20 100644 (file)
@@ -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;
        }
 
index 7af16a90f8c25e509f9eece23f1299f7a35459bb..66a85c9ce5915752b0594e271730ec5362809af2 100755 (executable)
@@ -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;
        }
 
index 155e52ab7b082c5d13f9de4d6f5ce7f26bef4e83..351dad196abeb352667078797aa72c8d89b47692 100644 (file)
@@ -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);
index 77c56decbe5b37510503e098427cfa3793219ece..790ee7b6f2e162d66bdbceea318edcb4adfca74f 100644 (file)
@@ -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;
 }
 
 
old mode 100755 (executable)
new mode 100644 (file)
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
old mode 100755 (executable)
new mode 100644 (file)
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
old mode 100755 (executable)
new mode 100644 (file)
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
old mode 100755 (executable)
new mode 100644 (file)
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
old mode 100755 (executable)
new mode 100644 (file)
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
old mode 100755 (executable)
new mode 100644 (file)
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
old mode 100755 (executable)
new mode 100644 (file)
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
old mode 100755 (executable)
new mode 100644 (file)
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
old mode 100755 (executable)
new mode 100644 (file)
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
index c3130bf5f8a0827adcdd68a084cac92ca20287b4..7730a4890b1f767e72aa944a296fe8b94536cfa4 100644 (file)
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
old mode 100755 (executable)
new mode 100644 (file)
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
old mode 100755 (executable)
new mode 100644 (file)
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
old mode 100755 (executable)
new mode 100644 (file)
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
old mode 100755 (executable)
new mode 100644 (file)
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
old mode 100755 (executable)
new mode 100644 (file)
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
old mode 100755 (executable)
new mode 100644 (file)
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
old mode 100755 (executable)
new mode 100644 (file)
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
old mode 100755 (executable)
new mode 100644 (file)
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
old mode 100755 (executable)
new mode 100644 (file)
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
old mode 100755 (executable)
new mode 100644 (file)
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
index 6c8408cba17a4f0ed9d8d39fbe14808fe87db0d6..63765b243fc1d974a1307cf1e939899b74a1fdb2 100644 (file)
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
old mode 100755 (executable)
new mode 100644 (file)
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
index 24fd00e188b3bbda9e33fb86bd29042726e78e58..5fd9f2030d6ddfcfaed71700729d8a69d6a88622 100644 (file)
@@ -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;
 }
index b1442f77ff8e1c78d1bbd5fc88d085a42b462dde..53e047a3cd91a17a2b92a5b201fd48fd9e055e04 100644 (file)
@@ -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)
index fb6ff4e904a3d1214beb3c7913835c79af3a5841..6218e6bb62c4f84e6cfd7031c5dbde27d94cd6d4 100644 (file)
@@ -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];
index ea00ea3cbd88626b4955c444e03dbbe04e38ffeb..4929f15b6e2557bd9ecb9eb784b0dde119fcfdfe 100644 (file)
@@ -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);
index 5d4bf1f30938866e3296e266bd7de36c02da8943..71cef4f5a2b58e4689a006e0ef5ca8f42bfb804d 100644 (file)
 
 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;
 }
index c69f982303582076f3206309e87a883e49793882..2d72ffe71ab89e2232db0ba3fa23797f2badb4e4 100644 (file)
@@ -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";
index c533bdd5936b1f6d325b3ab707d129571e828f84..71ac0382fe72d43470f9617eca5e649750e1d3f0 100644 (file)
@@ -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)
index eacc9846dc76c50152a43d6738f068404e2a0c65..9721f6815a224459346400dee16208f81b093b42 100644 (file)
 #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;
 }
index f08e0538fad654c48d606cf34718fcc1d5d68ec8..9a59f7f77f7f7379227ba107e23154094abf0a34 100644 (file)
@@ -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);
index 772ceab61ff057729bdd327dc78c9a61c19264eb..a68a8bd62791e6f09c2118824df9dc984b13729b 100644 (file)
     } \
 }
 
+#define RETM_IF_CLEANUP(expr, fmt, FreeResource, arg...) \
+{ \
+    if (expr) \
+    { \
+        ERR(fmt, ##arg); \
+       FreeResource; \
+        return; \
+    } \
+}
+
+
 #define RETVM_IF(expr, val, fmt, arg...) \
 { \
     if (expr) \
     } \
 }
 
+#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__ */
index 81c631027b0f196e0eace47fdcfa9ec1f0f6716e..7fdcf7f78d74afb163ca6671b65eb137f7dda010 100644 (file)
@@ -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);
index ee8d64289f47f260e1fdba990b6ac2cf6b1af040..2c7c85fef4d3694960d74fc2cfe2b1f8994da1b1 100644 (file)
@@ -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]++;
        }
 
 
index 09431c353a9c83ea1f7d84817ab3e07da3aa9cae..cde3d3fba14e8b19281ea3e5353d79a1f4d44072 100755 (executable)
@@ -317,6 +317,7 @@ static Evas_Object* create_bubble_table(Evas_Object *parent, Message_Bubble_Styl
                        break;
                }
        }
+       free(file_path);
        return bubble_table;
 
 }
index 5d7f30083c8257899ef5d158fe2cffa1b204e431..5270cfc93cc91f35521f38237e748be974644870 100644 (file)
@@ -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;
                }
        }
 }
index c30497077816a9db64461fb7707f4243caa590e8..09f5773e24846276cafda8f7531d0be32b92b641 100644 (file)
@@ -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
index cbf3ee421b1b37edb5b8693c7a42574d3c669570..679ff721447f6ac37c31909694ead0baa836c4a7 100644 (file)
@@ -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);
 
index 30eafdec4fde1b3555ae4d40bce48a68a92fb36d..15add6ad004f13ed0f007bd7b611c71ceb5c3769 100644 (file)
@@ -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);
        }
index c7f5cb25ad3fc2ab1ce75492d1e437459b08cd66..9cbb51ea10551bb6b883e1b2af78d444537b7187 100755 (executable)
@@ -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
index 3164958c6208288c72b95639fa18706e46dde80c..22b2d5da2107494dab5a5e1a1cbe2eb9c81d9285 100644 (file)
@@ -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;
index d4bf0fa76c0794669bd2f1622036aca36966fae7..465bc277cb6aa645d2b27aa53e08783c6f8df8e3 100644 (file)
@@ -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");
index 60d2e5c23e3d486cfc9a78197afde04992e82c3f..04510e30fdb5a95c86e83330338c003c3ac2ba88 100644 (file)
@@ -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;
 }
index b71f04ec8a8f13d6e3bb130171b0be6ce6a09d39..37e646df430e83a02728ca6238effef4f7c52020 100644 (file)
@@ -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)
index 5cc51495ba4488f07e2ce968bc968854497b8b8d..4ea656df37e82e3336ba3f3b3b4f018903d95d1a 100644 (file)
@@ -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;
 }
 
index 7645ffe52e0254624281162c5056958296941d9a..c21e44f5c0746fae5df997dd2a91539ada03859e 100644 (file)
@@ -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));
index 9f16baef3f1729fe4ef4cc50995390412699878b..c866694224f831460a93505462891a0700e17336 100644 (file)
@@ -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 ;
 }
index 444540884ff19eedb9a9b36449c3057d61d41073..84c43a25c5c3d446bad62ae13556ee07c4c3f607 100644 (file)
@@ -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;
 }
index 450447b3900f5602b4f79ac483d2e2dd5fac9723..dc6b8f84138f43eebca1c622f8cb139ccb525824 100644 (file)
@@ -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;
index 883db6788a29f70cd62e614c6e94d9a9f4642104..89c8878a40c96faade706b5b314efdbc6f0dce37 100644 (file)
@@ -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));
 
index fbb0989d138838e4de3bb2ec3bd3d914168a8507..329a5b24103e4c0fd26c6bee9672eaded5de7eff 100644 (file)
@@ -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;
     }
index 6c0c5d376659ad53e671126980b4e40e74956446..823962834d7ca6e6ca8471176d0d32d9cd63d93b 100644 (file)
@@ -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);
 }
 
 
index f89091214176a58afa1581b3e3356dddc6c33b4d..50afd7163aa54a4966a82933315c0a993e3e8be6 100644 (file)
@@ -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 ;
 }
index f3d04a246a94893b014f572f62fc1d75d4ba8ea4..f31e1df4f4e7022997254c5ffbc3a660ebb6f707 100644 (file)
@@ -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";
index c1cd2a4842a2eae3c7b8a25c2b8eaf676d2932a9..ae76a0d7536ef98577d938a5aa9e800aca89226d 100644 (file)
@@ -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;
        }
 
index ab0a1d015ec7c514300ea8720e6e0ac36c212a92..e12a1689d22a54ce9bfd4eb2dea5330c8760c746 100755 (executable)
@@ -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);
 
index d8ed4aa86bf8155c1859621b19333520b9a35c48..c66b810ebbe691ae5227edcafb2dda2f5f294adf 100644 (file)
@@ -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){
index 48fb7cd05dfbedf5b100571ce17914a4e670d703..5bca38f067e27ec1de878c7e64ab670f6c27e6db 100644 (file)
@@ -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);
 
 }
 
index f9d41dd5d095d53a87ea665f0b4748d4d7f29e4d..341ec939422f481284b838c6f3324e775d26d5a3 100644 (file)
@@ -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));
 }
 
 
index 51311146d6272b7080fc11888b4e5f53d9578e13..42981ab6c2672f0299121af0e8e651531856bbf0 100644 (file)
@@ -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;
 }
 
index a77476f08128fcc1fa660ffe018286cec43eccd4..a9e9127ee5e1e05143a35638e3af060c6dd01a21 100755 (executable)
@@ -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");
index d9cdbe8ef511f38440a43e669317cf3fa4cce39f..0395350bfa2b6870d9c0e22ef8d50ae0a539e5a2 100644 (file)
@@ -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");
index 21a2b21e6de647875f73e468808ddc0120a60d62..5940ddd88bbff70f8e38fa7db764384c716e881e 100644 (file)
@@ -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);
index 0584f8369822ae3e8dc09bd12e587ef4c9d56d29..054ef1f96941149625a1f05bae601bc04f24f5c1 100755 (executable)
@@ -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<br/><b>Note:You can also refer info section</b><br/>");
-
        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)