diff options
author | Hyeongsik Min <hyeongsik.min@samsung.com> | 2015-12-29 19:30:27 +0900 |
---|---|---|
committer | Hyeongsik Min <hyeongsik.min@samsung.com> | 2015-12-29 19:32:41 +0900 |
commit | 59df0a09ae75f2fdf16beb070efa8276f174f5fe (patch) | |
tree | d90d399e488b5c4701d077e309f6416a943b4fb1 | |
parent | e6f674b36844cf6609116f9ee10269f3a582d65e (diff) | |
download | memps-59df0a09ae75f2fdf16beb070efa8276f174f5fe.tar.gz memps-59df0a09ae75f2fdf16beb070efa8276f174f5fe.tar.bz2 memps-59df0a09ae75f2fdf16beb070efa8276f174f5fe.zip |
Fix Svace issuessubmit/tizen_ivi/20160217.000003submit/tizen_ivi/20160217.000000submit/tizen_common/20160218.142243submit/tizen/20151229.110102accepted/tizen/wearable/20151229.120020accepted/tizen/tv/20151229.120013accepted/tizen/mobile/20151229.120004accepted/tizen/ivi/20160218.023839
15723 - DIVISION_BY_ZERO
25769 - DIVISION_BY_ZERO
25770 - DIVISION_BY_ZERO
Change-Id: Icfed0528b6891af56f51c4c7864652ae01801ef8
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
-rw-r--r-- | memps.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -195,6 +195,8 @@ static geminfo *read_geminfo(FILE *fp) &hcount, &gem_size) != NUM_GEM_FIELD) return NULL; + if (hcount == 0) + return NULL; tgeminfo = malloc(sizeof(geminfo)); if (tgeminfo == NULL) return NULL; @@ -432,6 +434,12 @@ static void get_mem_info(FILE *output_fp) } } + if (total_mem == 0) { + fprintf(stderr, "cannot get total memory size\n"); + fclose(fp); + return; + } + if (available == 0) available = free + cached; used = total_mem - available; |