Explorar o código

ram: Check for theoretical division by zero

Aaron Marcher %!s(int64=7) %!d(string=hai) anos
pai
achega
ab4f24a612
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      components/ram.c

+ 4 - 0
components/ram.c

@@ -36,6 +36,10 @@
 			return NULL;
 		}
 
+		if (total == 0) {
+			return NULL;
+		}
+
 		return bprintf("%d", 100 * ((total - free) -
 		                            (buffers + cached)) / total);
 	}