From ab4f24a612fd40bb58b5504e979ad476533dd891 Mon Sep 17 00:00:00 2001 From: Aaron Marcher Date: Fri, 6 Jul 2018 23:38:12 +0200 Subject: ram: Check for theoretical division by zero --- components/ram.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/ram.c b/components/ram.c index 74bf337..8688349 100644 --- 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); } -- cgit v1.2.3