diff options
author | Kichan Kwon <k_c.kwon@samsung.com> | 2017-08-01 12:00:24 +0900 |
---|---|---|
committer | Kichan Kwon <k_c.kwon@samsung.com> | 2017-08-01 12:13:40 +0900 |
commit | 45f29aec4f9570a2048596af8a0c3b2ef60b2c10 (patch) | |
tree | 6b4f088a7b0896ab5e24a4883f94e94b4f9697f2 | |
parent | 07862ed68e8659478e74330afcf7e3be5c24e1ba (diff) | |
download | resourced-accepted/tizen_3.0_ivi.tar.gz resourced-accepted/tizen_3.0_ivi.tar.bz2 resourced-accepted/tizen_3.0_ivi.zip |
Fix minor issuessubmit/tizen_3.0/20170816.010551accepted/tizen/3.0/wearable/20170817.004648accepted/tizen/3.0/tv/20170817.004657accepted/tizen/3.0/mobile/20170817.004614accepted/tizen/3.0/ivi/20170817.004644accepted/tizen/3.0/common/20170817.131002accepted/tizen_3.0_ivi
- Assert the result of malloc
- Convert not the result but operand
Change-Id: I87e9f8eb40fb53007eb6531a34c7950bc910ac4d
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
-rw-r--r-- | src/common/procfs.c | 2 | ||||
-rw-r--r-- | src/heart/heart-cpu.c | 4 | ||||
-rw-r--r-- | src/heart/logging.c | 2 |
3 files changed, 7 insertions, 1 deletions
diff --git a/src/common/procfs.c b/src/common/procfs.c index eaa6756b..a716840c 100644 --- a/src/common/procfs.c +++ b/src/common/procfs.c @@ -327,7 +327,7 @@ int proc_get_zram_usage(pid_t pid, unsigned int *usage) * Calculate aproximated value of zram usage for selected process * by formula: proc_zram_usage = ( VmSwap x ZramMemoryUsage )/SwapTotal */ - *usage = ((float)((proc_swap_usage*BYTE_TO_KBYTE(zram_usage))/swap_total)); + *usage = (float)proc_swap_usage * BYTE_TO_KBYTE(zram_usage) / swap_total; return RESOURCED_ERROR_NONE; } diff --git a/src/heart/heart-cpu.c b/src/heart/heart-cpu.c index b9de90cf..b0c04fdd 100644 --- a/src/heart/heart-cpu.c +++ b/src/heart/heart-cpu.c @@ -647,6 +647,8 @@ void heart_cpu_update(struct logging_table_form *data, void *user_data) return; } cache = (struct heart_cpu_dat_cache*)malloc(sizeof(struct heart_cpu_dat_cache)); + assert(cache); + cache->path = strndup(path, strlen(path)); cache->list = g_hash_table_new_full( g_str_hash, @@ -1527,6 +1529,8 @@ static int heart_cpu_init(void *data) userinfo_for_each(elem, user_list) { cache = (struct heart_cpu_dat_cache*)malloc(sizeof(struct heart_cpu_dat_cache)); + assert(cache); + cache->path = strndup(elem->home_dir, strlen(elem->home_dir)); cache->list = g_hash_table_new_full( g_str_hash, diff --git a/src/heart/logging.c b/src/heart/logging.c index b9070f18..86c0232d 100644 --- a/src/heart/logging.c +++ b/src/heart/logging.c @@ -415,6 +415,8 @@ int logging_module_init(char *name, enum logging_period max_period, return RESOURCED_ERROR_DB_FAILED; } db_elem = (struct logging_db*)malloc(sizeof(struct logging_db)); + assert(db_elem); + db_elem->path = strndup(db_path, sizeof(db_path)); db_elem->file = db_file; db_elem->insert_stmt = NULL; |