summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKiseok Chang <kiso.chang@samsung.com>2018-04-26 14:22:25 +0900
committerKiseok Chang <kiso.chang@samsung.com>2018-04-26 14:22:40 +0900
commit6219e1de50b6ffebc5a7ecc7c6ac2d442e52b31a (patch)
tree85232d88742be423cb17a211e7f559fc7f15ec3b
parentd163d97cdb7dd9cd165b565daf14ad97e743f4ac (diff)
downloadsettings-6219e1de50b6ffebc5a7ecc7c6ac2d442e52b31a.tar.gz
settings-6219e1de50b6ffebc5a7ecc7c6ac2d442e52b31a.tar.bz2
settings-6219e1de50b6ffebc5a7ecc7c6ac2d442e52b31a.zip
Fix a potential bug reported by Coverity systemsubmit/tizen/20180426.052458accepted/tizen/unified/20180426.145845
Change-Id: I16add538a6656d33572250f80f6a21ed84c9a9f0 Signed-off-by: Kiseok Chang <kiso.chang@samsung.com>
-rw-r--r--setting-about/src/setting-about-status.c6
-rw-r--r--setting-applications/src/setting-applications.c1
-rw-r--r--setting-appmgr/src/setting-appmgr-main.c3
-rwxr-xr-xsetting-appmgr/src/setting-appmgr-pkginfo.c8
-rwxr-xr-xsetting-common/src/setting-common-general-func.c6
-rwxr-xr-xsetting-display/src/setting-display-brightness.c4
-rwxr-xr-xsetting-font/src/setting-font-main.c16
-rwxr-xr-xsetting-language-and-input/include/setting-language-and-input.h1
-rwxr-xr-xsetting-profile/src/setting-profile-sound-main.c4
-rwxr-xr-xsetting-storage/src/setting-storage-applications-utils.c3
10 files changed, 36 insertions, 16 deletions
diff --git a/setting-about/src/setting-about-status.c b/setting-about/src/setting-about-status.c
index ba8a5e6..3227bfb 100644
--- a/setting-about/src/setting-about-status.c
+++ b/setting-about/src/setting-about-status.c
@@ -191,7 +191,7 @@ static Eina_Bool __setting_about_status_timer_update_cb(void *data)
snprintf(str, sizeof(str), "%s",
_("IDS_ST_HEADER_UNAVAILABLE"));
} else {
- snprintf(str, sizeof(str), "%.0f%s", usr + sys, "\%");
+ snprintf(str, sizeof(str), "%.0f%%", usr + sys);
}
free(ad->item_data_cpu->sub_desc);
ad->item_data_cpu->sub_desc = (char *)g_strdup(str);
@@ -335,7 +335,7 @@ static int __generate_genlist(void *data)
snprintf(str, sizeof(str), "%s",
_("IDS_ST_HEADER_UNAVAILABLE"));
} else {
- snprintf(str, sizeof(str), "%.0f%s", usr + sys, "\%");
+ snprintf(str, sizeof(str), "%.0f%%", usr + sys);
}
ad->item_data_cpu = setting_create_Gendial_field_def(ad->status_gl,
&(ad->itc_2text_2), NULL, ad, SWALLOW_Type_INVALID,
@@ -526,7 +526,7 @@ static void __get_battery_percent(char *str, int size)
if ((r >= 0) && (r < MAX_DISPLAY_STR_LEN_ON_PHONE_INFO)) {
buf[r] = '\0';
val = atoi(buf);
- snprintf(str, size, "%d%s", val, "\%");
+ snprintf(str, size, "%d%%", val);
} else {
SETTING_TRACE_ERROR("read file fail");
snprintf(str, size, "%s",
diff --git a/setting-applications/src/setting-applications.c b/setting-applications/src/setting-applications.c
index 5d8b934..40cae53 100644
--- a/setting-applications/src/setting-applications.c
+++ b/setting-applications/src/setting-applications.c
@@ -123,6 +123,7 @@ static Evas_Object *_gl_1button1_icon_get(void *data, Evas_Object *obj,
SETTING_TRACE(" ==> appid [%s], icon [%s]", info->pkgid, _icon);
pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ free(_icon);
}
elm_image_file_set(icon, info->icon_path, NULL);
diff --git a/setting-appmgr/src/setting-appmgr-main.c b/setting-appmgr/src/setting-appmgr-main.c
index 6534919..ea6571e 100644
--- a/setting-appmgr/src/setting-appmgr-main.c
+++ b/setting-appmgr/src/setting-appmgr-main.c
@@ -377,8 +377,7 @@ char *main_genlist_item_text_get(void *data, Evas_Object *obj,
if (!strcmp(part, "elm.text"))
label = SAFE_STRDUP(node->label);
-
- if (!strcmp(part, "elm.text.sub") && node->size >= 0) {
+ else if (!strcmp(part, "elm.text.sub") && node->size >= 0) {
appmgr_size_to_str(node->size, desc, sizeof(desc));
label = strdup(desc);
}
diff --git a/setting-appmgr/src/setting-appmgr-pkginfo.c b/setting-appmgr/src/setting-appmgr-pkginfo.c
index 3201b7b..bf947cb 100755
--- a/setting-appmgr/src/setting-appmgr-pkginfo.c
+++ b/setting-appmgr/src/setting-appmgr-pkginfo.c
@@ -643,6 +643,8 @@ static int _get_package_information(SettingAppMgr *ad)
pkg->is_webapp = false;
if (!safeStrCmp(tmp, "wgt"))
pkg->is_webapp = true;
+ free(tmp);
+
finish:
package_manager_filter_destroy(filter_is_disabled_h);
package_manager_filter_destroy(filter_supports_disable_h);
@@ -985,7 +987,7 @@ char *pkginfo_icon_name_ver_text_get(void *data, Evas_Object *obj,
if (0 == strcmp(part, "elm.text"))
label = SAFE_STRDUP(pkg->label);
- if (0 == strcmp(part, "elm.text.sub")) {
+ else if (0 == strcmp(part, "elm.text.sub")) {
snprintf(desc, sizeof(desc), _(MGRAPP_STR_VERSION_STR),
pkg->pkg_version);
@@ -1419,7 +1421,6 @@ static void _move_to_from_sd(void *data, Evas_Object *genlist, void *event_info)
} else {
move_type = PM_MOVE_TO_SDCARD;
}
-
} else {
/* portable/card removed assumed, should never happen: */
move_type = PM_MOVE_TO_SDCARD;
@@ -1443,6 +1444,9 @@ static void _move_to_from_sd(void *data, Evas_Object *genlist, void *event_info)
SETTING_TRACE_ERROR("pkgmgr_client_move(): %d", ret);
appmgr_fail_popup(MGRAPP_STR_MOVE_FAIL, ad);
}
+ pkgmgr_client_free(pc_request);
+
+ free(type);
}
static Eina_Bool _privilege_detail_pop_cb(void *data, Elm_Object_Item *it)
diff --git a/setting-common/src/setting-common-general-func.c b/setting-common/src/setting-common-general-func.c
index 9981d13..df40d69 100755
--- a/setting-common/src/setting-common-general-func.c
+++ b/setting-common/src/setting-common-general-func.c
@@ -881,8 +881,12 @@ EXPORT_PUBLIC int app_group_launcher(const char *pkg_name)
{
int ret = -1;
char *path = get_path_from_args((void *)pkg_name);
+ retv_if(!path, -1);
app_control_h service = get_svc_from_args((void *)pkg_name);
- retv_if(!service || !path, -1);
+ if (!service) {
+ free(path);
+ return -1;
+ }
app_control_set_operation(service, APP_CONTROL_OPERATION_PICK);
app_control_set_launch_mode(service, APP_CONTROL_LAUNCH_MODE_GROUP);
diff --git a/setting-display/src/setting-display-brightness.c b/setting-display/src/setting-display-brightness.c
index dc1bac4..86547d7 100755
--- a/setting-display/src/setting-display-brightness.c
+++ b/setting-display/src/setting-display-brightness.c
@@ -93,6 +93,7 @@ static void update_overheating_text(void *data)
}
+
#ifdef __USE_DBUS__
/*------------------------------------------------------ */
/* for client - bus */
@@ -237,8 +238,10 @@ static int setting_brightness_dbus_handler_init(void *user_data)
return 0;
}
+
#endif
+
static void _brightness_register_event_cb(void *data)
{
int ret = 0;
@@ -738,6 +741,7 @@ void construct_brightness(void *data, Evas_Object *genlist)
#ifdef __USE_DBUS__
setting_brightness_dbus_handler_init(ad);
#endif
+
}
void destruct_brightness(void *data)
diff --git a/setting-font/src/setting-font-main.c b/setting-font/src/setting-font-main.c
index 96eacb5..e856367 100755
--- a/setting-font/src/setting-font-main.c
+++ b/setting-font/src/setting-font-main.c
@@ -997,8 +997,12 @@ static int setting_font_main_create(void *cb)
SETTING_TRACE_DEBUG("default_font_name:%s", default_font_name);
Setting_GenGroupItem_Data *item_data = (Setting_GenGroupItem_Data *)
calloc(1, sizeof(Setting_GenGroupItem_Data));
- setting_retvm_if(!item_data, SETTING_RETURN_SUCCESS,
- "calloc failed");
+ if (!item_data) {
+ FREE(default_font_name);
+ SETTING_TRACE_ERROR("calloc failed");
+ return SETTING_RETURN_SUCCESS;
+ }
+
item_data->keyStr2 = (char *)g_strdup(
SETTING_DEFAULT_FONT_TYPE);/*for display */
/*for tts reading */
@@ -1041,8 +1045,12 @@ static int setting_font_main_create(void *cb)
(char *)font_data);
Setting_GenGroupItem_Data *item_data = (Setting_GenGroupItem_Data *)calloc(
1, sizeof(Setting_GenGroupItem_Data));
- setting_retvm_if(!item_data, SETTING_RETURN_SUCCESS,
- "calloc failed");
+ if (!item_data) {
+ FREE(default_font_name);
+ SETTING_TRACE_ERROR("calloc failed");
+ return SETTING_RETURN_SUCCESS;
+ }
+
/*for display */
item_data->keyStr2 = (char *)g_strdup(temp);
/*for tts reading */
diff --git a/setting-language-and-input/include/setting-language-and-input.h b/setting-language-and-input/include/setting-language-and-input.h
index 6496877..6b920f5 100755
--- a/setting-language-and-input/include/setting-language-and-input.h
+++ b/setting-language-and-input/include/setting-language-and-input.h
@@ -35,7 +35,6 @@
#include "setting-common-draw-widget.h"
#include "setting-common-view.h"
#include "setting-common-init.h"
-#include "setting-language-and-input.h"
#define REGION_ITEM_MAX 300
#define REGION_FORMAT_LOWER "IDS_ST_BODY_REGION"
diff --git a/setting-profile/src/setting-profile-sound-main.c b/setting-profile/src/setting-profile-sound-main.c
index 1288e97..a35078e 100755
--- a/setting-profile/src/setting-profile-sound-main.c
+++ b/setting-profile/src/setting-profile-sound-main.c
@@ -1251,9 +1251,7 @@ static void _create_myfile_ug(SettingSoundData *ad, char *titleID)
SETTING_DEFAULT_CALL_TONE_SDK,
SETTING_DEFAULT_CALL_TONE);
- }
-
- if (0 == safeStrCmp(ad->ringtone_type, "IDS_ST_BODY_NOTIFICATION")) {
+ } else if (0 == safeStrCmp(ad->ringtone_type, "IDS_ST_BODY_NOTIFICATION")) {
pa_cur_ringtone = _prepare_ringtone_path(
VCONFKEY_SETAPPL_NOTI_RINGTONE_PATH_STR,
SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION,
diff --git a/setting-storage/src/setting-storage-applications-utils.c b/setting-storage/src/setting-storage-applications-utils.c
index 437f272..8005d3c 100755
--- a/setting-storage/src/setting-storage-applications-utils.c
+++ b/setting-storage/src/setting-storage-applications-utils.c
@@ -228,6 +228,7 @@ void storage_apps_get_node_info(package_info_h handle, Node_Info *info)
"pkgmgrinfo_pkginfo_get_pkgid() Fail(%s)",
get_error_message(ret));
info->id = SAFE_STRDUP(value);
+ free(value);
SETTING_TRACE("#>>package: [%s]", info->id);
value = NULL;
@@ -236,6 +237,7 @@ void storage_apps_get_node_info(package_info_h handle, Node_Info *info)
"pkgmgrinfo_pkginfo_get_label() Fail(%s)",
get_error_message(ret));
info->name = SAFE_STRDUP(value);
+ free(value);
value = NULL;
ret = package_info_get_icon(handle, &value);
@@ -243,6 +245,7 @@ void storage_apps_get_node_info(package_info_h handle, Node_Info *info)
"pkgmgrinfo_pkginfo_get_icon() Fail(%s)",
get_error_message(ret));
info->l_icon = appmgr_check_icon(value);
+ free(value);
/* Get time of installed by icon path */
info->added_time = ecore_file_mod_time(info->l_icon);