gl-renderer: Fix crash in dmabuf format query for fallback formats
authorPhilipp Kerling <pkerling@casix.org>
Fri, 9 Feb 2018 20:59:17 +0000 (21:59 +0100)
committerDaniel Stone <daniels@collabora.com>
Mon, 12 Feb 2018 09:11:40 +0000 (09:11 +0000)
Since formats is an out parameter, we need to copy to the alloc'ed
memory and not over the pointer address.

Signed-off-by: Philipp Kerling <pkerling@casix.org>
Reviewed-by: Daniel Stone <daniels@collabora.com>
libweston/gl-renderer.c

index 371e06b..d091d16 100644 (file)
@@ -2122,7 +2122,7 @@ gl_renderer_query_dmabuf_formats(struct weston_compositor *wc,
        }
 
        if (fallback) {
-               memcpy(formats, fallback_formats, num * sizeof(int));
+               memcpy(*formats, fallback_formats, num * sizeof(int));
                *num_formats = num;
                return;
        }