fixed fbdev/*.cc to work with malloc
[winnie] / src / fbdev / gfx.cc
index d0a8178..9984422 100644 (file)
@@ -30,6 +30,10 @@ static Graphics *gfx;
 
 bool init_gfx()
 {
+       if(!(gfx = (Graphics*)malloc(sizeof *gfx))) {
+               return false;
+       }
+
        gfx->dev_fd = -1;
 
        if((gfx->dev_fd = open("/dev/fb0", O_RDWR)) == -1) {
@@ -45,10 +49,6 @@ bool init_gfx()
                return false;
        }
 
-       if(!(gfx = (Graphics*)malloc(sizeof *gfx))) {
-               return false;
-       }
-
        printf("width : %d height : %d\n : bpp : %d\n", sinfo.xres, sinfo.yres, sinfo.bits_per_pixel);
        printf("virtual w: %d virtual h: %d\n", sinfo.xres_virtual, sinfo.yres_virtual);