From da64a534f638ce2aa7c7daa6d1acf72bff97f699 Mon Sep 17 00:00:00 2001 From: Sunyeop Hwang Date: Sat, 12 Jan 2013 12:33:12 +0900 Subject: [PATCH] Fix prevent issues Change-Id: Ie6bf63c5c0a4148bd17ad67c34e7edd23e04bc22 --- setting-about/src/setting-about-main.c | 1 + setting-profile/src/setting-profile-sound-main.c | 10 +++++----- setting-profile/src/setting-profile.c | 24 ++++++++++-------------- src/setting-plugin.c | 7 ++++--- 4 files changed, 20 insertions(+), 22 deletions(-) diff --git a/setting-about/src/setting-about-main.c b/setting-about/src/setting-about-main.c index 066eb68..9034bff 100755 --- a/setting-about/src/setting-about-main.c +++ b/setting-about/src/setting-about-main.c @@ -569,6 +569,7 @@ static void __entry_unfocus_cb(void *data, Evas_Object *obj, void *event_info) setting_hide_input_pannel_cb(item_dev_name->eo_check); if (item_dev_name) { if (ad->empty_flag) { + FREE(entry_str_utf8); return; } else { } diff --git a/setting-profile/src/setting-profile-sound-main.c b/setting-profile/src/setting-profile-sound-main.c index 63b0dbc..96ca12f 100755 --- a/setting-profile/src/setting-profile-sound-main.c +++ b/setting-profile/src/setting-profile-sound-main.c @@ -378,7 +378,7 @@ void __volume_stop_change_cb(void *data, Evas_Object *obj, void *event_info) pa_tone_path = vconf_get_str(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR); if(pa_tone_path == NULL) { - pa_tone_path = SETTING_DEFAULT_CALL_TONE; + pa_tone_path = (char *)strdup(SETTING_DEFAULT_CALL_TONE); if(vconf_set_str(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, pa_tone_path) < 0) return; @@ -397,7 +397,7 @@ void __volume_stop_change_cb(void *data, Evas_Object *obj, void *event_info) pa_tone_path = vconf_get_str(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR); if(pa_tone_path == NULL) { - pa_tone_path = SETTING_DEFAULT_MSG_TONE; + pa_tone_path = (char *)strdup(SETTING_DEFAULT_MSG_TONE); if(vconf_set_str(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SETTING_DEFAULT_MSG_TONE) < 0) return; } @@ -1261,18 +1261,18 @@ static void setting_profile_sound_main_create_myfile_ug(SettingProfileUG *ad) pa_cur_ringtone = vconf_get_str(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR); if (pa_cur_ringtone == NULL) { - pa_cur_ringtone = SETTING_DEFAULT_CALL_TONE; + pa_cur_ringtone = (char *)strdup(SETTING_DEFAULT_CALL_TONE); } dir_path = SETTING_PROFILE_SOUND_RINGTONES_PATH; } else if (0 == safeStrCmp(ad->ringtone_type, SETTING_SOUND_TEXT_MSG_ALERT)) { pa_cur_ringtone = vconf_get_str(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR); if (pa_cur_ringtone == NULL) - pa_cur_ringtone = SETTING_DEFAULT_MSG_TONE; + pa_cur_ringtone = (char *)strdup(SETTING_DEFAULT_MSG_TONE); dir_path = SETTING_PROFILE_SOUND_ALERTS_PATH; } else if (0 == safeStrCmp(ad->ringtone_type, SETTING_SOUND_TEXT_EMAIL_ALERT)) { pa_cur_ringtone = vconf_get_str(VCONFKEY_SETAPPL_NOTI_EMAIL_RINGTONE_PATH_STR); if (pa_cur_ringtone == NULL) - pa_cur_ringtone = SETTING_DEFAULT_EMAIL_TONE; + pa_cur_ringtone = (char *)strdup(SETTING_DEFAULT_EMAIL_TONE); dir_path = SETTING_PROFILE_SOUND_ALERTS_PATH; } SETTING_TRACE("pa_cur_ringtone:\t%s", pa_cur_ringtone); diff --git a/setting-profile/src/setting-profile.c b/setting-profile/src/setting-profile.c index 1848193..d8523e7 100755 --- a/setting-profile/src/setting-profile.c +++ b/setting-profile/src/setting-profile.c @@ -544,10 +544,8 @@ static void setting_profile_ug_on_resume(ui_gadget_h ug, service_h service, void profileUG->data_call_alert_tone->sub_desc = setting_file_basename(pa_tone_path); elm_genlist_item_update(profileUG->data_call_alert_tone->item); } - if (pa_tone_path) { - free(pa_tone_path); - pa_tone_path = NULL; - } + + FREE(pa_tone_path); } /* 2. message ringtone */ @@ -557,17 +555,16 @@ static void setting_profile_ug_on_resume(ui_gadget_h ug, service_h service, void pa_tone_path = vconf_get_str(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR); if((pa_tone_path == NULL) || (setting_profile_check_file_exist(profileUG, pa_tone_path) == SETTING_RETURN_FAIL)) { - pa_tone_path = SETTING_DEFAULT_MSG_TONE; + pa_tone_path = (char *)strdup(SETTING_DEFAULT_MSG_TONE); if(vconf_set_str(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SETTING_DEFAULT_MSG_TONE) < 0) return; profileUG->data_msg_alert_tone->sub_desc = setting_file_basename(pa_tone_path); elm_genlist_item_update(profileUG->data_msg_alert_tone->item); } - if (pa_tone_path) { - free(pa_tone_path); - pa_tone_path = NULL; - } + + FREE(pa_tone_path); + } /* 3. email ringtone */ @@ -577,16 +574,15 @@ static void setting_profile_ug_on_resume(ui_gadget_h ug, service_h service, void pa_tone_path = vconf_get_str(VCONFKEY_SETAPPL_NOTI_EMAIL_RINGTONE_PATH_STR); if((pa_tone_path == NULL) || (setting_profile_check_file_exist(profileUG, pa_tone_path) == SETTING_RETURN_FAIL)) { - pa_tone_path = SETTING_DEFAULT_MSG_TONE; + pa_tone_path = (char *)strdup(SETTING_DEFAULT_MSG_TONE); if(vconf_set_str(VCONFKEY_SETAPPL_NOTI_EMAIL_RINGTONE_PATH_STR, SETTING_DEFAULT_MSG_TONE) < 0) return; profileUG->data_email_alert_tone->sub_desc = setting_file_basename(pa_tone_path); elm_genlist_item_update(profileUG->data_email_alert_tone->item); } - if (pa_tone_path) { - free(pa_tone_path); - pa_tone_path = NULL; - } + + FREE(pa_tone_path); + } } diff --git a/src/setting-plugin.c b/src/setting-plugin.c index c2fe5fc..d735020 100755 --- a/src/setting-plugin.c +++ b/src/setting-plugin.c @@ -1453,11 +1453,12 @@ PluginNode* setting_plugin_create() { PluginNode *node = calloc(1, sizeof(PluginNode)); + setting_retvm_if(!node, -1, "Create PluginNode obj failed"); + Draw_Data *pd = calloc(1, sizeof(Draw_Data)); - if (node && !pd) { - free(node); - node = NULL; + if (!pd) { + FREE(node); } setting_retvm_if(!pd, -1, "Create Draw_Data obj failed"); -- 2.7.4