diff --git a/gdk/gdkdmabufformats.c b/gdk/gdkdmabufformats.c index 3e45e22ff9..5b7b19ef48 100644 --- a/gdk/gdkdmabufformats.c +++ b/gdk/gdkdmabufformats.c @@ -207,7 +207,8 @@ gdk_dmabuf_formats_new (GdkDmabufFormat *formats, self->n_formats = n_formats; self->formats = g_new (GdkDmabufFormat, n_formats); - memcpy (self->formats, formats, n_formats * sizeof (GdkDmabufFormat)); + if (n_formats != 0) + memcpy (self->formats, formats, n_formats * sizeof (GdkDmabufFormat)); return self; } diff --git a/gtk/gtksymbolicpaintable.c b/gtk/gtksymbolicpaintable.c index 057be29742..0509eb5d9c 100644 --- a/gtk/gtksymbolicpaintable.c +++ b/gtk/gtksymbolicpaintable.c @@ -110,7 +110,8 @@ gtk_symbolic_paintable_snapshot_symbolic (GtkSymbolicPaintable *paintable, [GTK_SYMBOLIC_COLOR_SUCCESS] = { 0.3046921492332342,0.6015716792553597, 0.023437857633325704, 1.0 } }; - memcpy (real_colors, colors, sizeof (GdkRGBA) * n_colors); + if (n_colors != 0) + memcpy (real_colors, colors, sizeof (GdkRGBA) * n_colors); iface->snapshot_symbolic (paintable, snapshot, width, height, real_colors, 4); }