< prev index next >
src/java.desktop/unix/native/libawt_xawt/awt/multiVis.c
Print this page
@@ -216,11 +216,15 @@
unsigned long redMask, greenMask, blueMask;
int redShift, greenShift, blueShift;
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)
{
for(i=0 ; i < ncolors ; i++)
{
< prev index next >