From d8ac258acc503514029823c78d0a7478c4358033 Mon Sep 17 00:00:00 2001 From: dmarkov Date: Mon, 23 Sep 2019 17:18:03 +0100 Subject: [PATCH] 8230782: Robot.createScreenCapture() fails if ?awt.robot.gtk? is set to false Reviewed-by: prr, serb --- src/solaris/native/sun/awt/multiVis.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/solaris/native/sun/awt/multiVis.c b/src/solaris/native/sun/awt/multiVis.c index 258ea5b2a..539e29211 100644 --- a/src/solaris/native/sun/awt/multiVis.c +++ b/src/solaris/native/sun/awt/multiVis.c @@ -218,7 +218,11 @@ QueryColorMap(Display *disp, Colormap src_cmap, Visual *src_vis, XColor *colors ; ncolors = (unsigned) src_vis->map_entries ; - *src_colors = colors = (XColor *)malloc(ncolors * sizeof(XColor) ) ; +/* JDK modification. + * use calloc instead of malloc to initialize allocated memory + * *src_colors = colors = (XColor *)malloc(ncolors * sizeof(XColor) ) ; + */ + *src_colors = colors = (XColor *)calloc(ncolors, sizeof(XColor)); if(src_vis->class != TrueColor && src_vis->class != DirectColor) { -- GitLab