diff --git a/src/raw-encoding.c b/src/raw-encoding.c index 4f2e2c1..4fb3298 100644 --- a/src/raw-encoding.c +++ b/src/raw-encoding.c @@ -19,10 +19,6 @@ int raw_encode_box(struct vec *dst, const struct rfb_pixel_format *dst_fmt, .height = htons(height), }; - rc = vec_reserve(dst, width * height * 4 + 256); - if (rc < 0) - return -1; - rc = vec_append(dst, &rect, sizeof(rect)); if (rc < 0) return -1; @@ -62,6 +58,10 @@ int raw_encode_frame(struct vec *dst, .n_rects = htons(n_rects), }; + rc = vec_reserve(dst, src->width * src->height * 4 + 256); + if (rc < 0) + return -1; + rc = vec_append(dst, &head, sizeof(head)); if (rc < 0) return -1;