+ if (!state)
+ {
+ outputf("rfb_accept: out of memory\n");
+ return ERR_MEM;
+ }
+
+ memset(state, 0, sizeof(struct rfb_state));
+
+ blockbuf = mem_malloc(ceildiv(fb->curmode.xres, SCREEN_CHUNKS_X)
+ * ceildiv(fb->curmode.yres, SCREEN_CHUNKS_Y) * 4);
+
+ if (!blockbuf)
+ {
+ outputf("rfb_accept: out of memory allocating blockbuf\n");
+ mem_free(state);
+ return ERR_MEM;
+ }
+
+ state->blockbuf = blockbuf;