Преглед изворни кода

ram: Check for theoretical division by zero

Aaron Marcher пре 7 година
родитељ
комит
ab4f24a612
1 измењених фајлова са 4 додато и 0 уклоњено
  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);
 	}