From 0f840b9bb759c4c6c1e61a2d819d478824d36809 Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Sat, 21 Sep 2019 13:33:37 +0000 Subject: [PATCH] raw-encoding: Fix vec_reserve for destination buffer --- src/raw-encoding.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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;