fbdev: don't clear more than needed
[libpicofe.git] / linux / fbdev.c
index ec3d5c7..d8d78eb 100644 (file)
@@ -5,6 +5,7 @@
  * (at your option):
  *  - GNU GPL, version 2 or later.
  *  - GNU LGPL, version 2.1 or later.
+ *  - MAME license.
  * See the COPYING file in the top-level directory.
  */
 
@@ -154,7 +155,8 @@ out:
 
 void vout_fbdev_clear(struct vout_fbdev *fbdev)
 {
-       memset(fbdev->mem, 0, fbdev->mem_size);
+       if (fbdev->mem)
+               memset(fbdev->mem, 0, fbdev->fb_size * fbdev->buffer_count);
 }
 
 void vout_fbdev_clear_lines(struct vout_fbdev *fbdev, int y, int count)