ram: Check for theoretical division by zero
Aaron Marcher me@drkhsh.at
Fri, 06 Jul 2018 23:38:12 +0200
1 files changed,
4 insertions(+),
0 deletions(-)
jump to
M
components/ram.c
→
components/ram.c
@@ -36,6 +36,10 @@ &total, &free, &buffers, &buffers, &cached) != 5) {
return NULL; } + if (total == 0) { + return NULL; + } + return bprintf("%d", 100 * ((total - free) - (buffers + cached)) / total); }