Instead of using spice_malloc+memcpy use spice_memdup which is doing the same. Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> --- common/canvas_base.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/common/canvas_base.c b/common/canvas_base.c index 39439ed..f4f301c 100644 --- a/common/canvas_base.c +++ b/common/canvas_base.c @@ -737,16 +737,13 @@ static inline SpicePalette *canvas_get_localized_palette(CanvasBase *canvas, Spi SpicePalette *palette = canvas_get_palette(canvas, base_palette, palette_id, flags); SpicePalette *copy; uint32_t *now, *end; - size_t size; if (canvas->format == SPICE_SURFACE_FMT_32_xRGB || canvas->format == SPICE_SURFACE_FMT_32_ARGB) { return palette; } - size = sizeof(SpicePalette) + palette->num_ents * 4; - copy = (SpicePalette *)spice_malloc(size); - memcpy(copy, palette, size); + copy = spice_memdup(palette, sizeof(SpicePalette) + palette->num_ents * 4); switch (canvas->format) { case SPICE_SURFACE_FMT_32_xRGB: -- 2.14.3 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel