فهرست منبع

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);
 	}