Fix Svace issues 09/55809/1 accepted/tizen/ivi/20160218.023839 accepted/tizen/mobile/20151229.120004 accepted/tizen/tv/20151229.120013 accepted/tizen/wearable/20151229.120020 submit/tizen/20151229.110102 submit/tizen_common/20160218.142243 submit/tizen_ivi/20160217.000000 submit/tizen_ivi/20160217.000003
authorHyeongsik Min <hyeongsik.min@samsung.com>
Tue, 29 Dec 2015 10:30:27 +0000 (19:30 +0900)
committerHyeongsik Min <hyeongsik.min@samsung.com>
Tue, 29 Dec 2015 10:32:41 +0000 (19:32 +0900)
15723 - DIVISION_BY_ZERO
25769 - DIVISION_BY_ZERO
25770 - DIVISION_BY_ZERO

Change-Id: Icfed0528b6891af56f51c4c7864652ae01801ef8
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
memps.c

diff --git a/memps.c b/memps.c
index 082d6d2..33ec5b4 100644 (file)
--- a/memps.c
+++ b/memps.c
@@ -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;