Xinqi Bao's Git
projects
/
slstatus.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
| inline |
side by side
ram: Check for theoretical division by zero
[slstatus.git]
/
components
/
ram.c
diff --git
a/components/ram.c
b/components/ram.c
index
74bf337
..
8688349
100644
(file)
--- a/
components/ram.c
+++ b/
components/ram.c
@@
-36,6
+36,10
@@
return NULL;
}
+ if (total == 0) {
+ return NULL;
+ }
+
return bprintf("%d", 100 * ((total - free) -
(buffers + cached)) / total);
}