[Commit] Xft xftdraw.c,1.27,1.28 xftfreetype.c,1.33,1.34 xftglyphs.c,1.25,1.26
Keith Packard
commit@keithp.com
Wed, 30 Apr 2003 17:13:19 -0700
Committed by: keithp
Update of /local/src/CVS/Xft
In directory home.keithp.com:/tmp/cvs-serv13690
Modified Files:
xftdraw.c xftfreetype.c xftglyphs.c
Log Message:
Avoid uninitialized fields. Dont call malloc for zero bytes
Index: xftdraw.c
===================================================================
RCS file: /local/src/CVS/Xft/xftdraw.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- xftdraw.c 17 Apr 2003 04:29:24 -0000 1.27
+++ xftdraw.c 1 May 2003 00:13:17 -0000 1.28
@@ -177,6 +177,7 @@
draw->colormap = 0;
draw->render.pict = 0;
draw->core.gc = 0;
+ draw->core.use_pixmap = 0;
draw->clip_type = XftClipTypeNone;
draw->subwindow_mode = ClipByChildren;
XftMemAlloc (XFT_MEM_DRAW, sizeof (XftDraw));
@@ -202,6 +203,7 @@
draw->colormap = 0;
draw->render.pict = 0;
draw->core.gc = 0;
+ draw->core.use_pixmap = 0;
draw->clip_type = XftClipTypeNone;
draw->subwindow_mode = ClipByChildren;
XftMemAlloc (XFT_MEM_DRAW, sizeof (XftDraw));
Index: xftfreetype.c
===================================================================
RCS file: /local/src/CVS/Xft/xftfreetype.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- xftfreetype.c 28 Apr 2003 05:20:45 -0000 1.33
+++ xftfreetype.c 1 May 2003 00:13:17 -0000 1.34
@@ -81,6 +81,7 @@
f->face = 0;
f->xsize = 0;
f->ysize = 0;
+ f->matrix.xx = f->matrix.xy = f->matrix.yx = f->matrix.yy = 0;
return f;
}
@@ -103,6 +104,7 @@
f->face = face;
f->xsize = 0;
f->ysize = 0;
+ f->matrix.xx = f->matrix.xy = f->matrix.yx = f->matrix.yy = 0;
return f;
}
Index: xftglyphs.c
===================================================================
RCS file: /local/src/CVS/Xft/xftglyphs.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- xftglyphs.c 30 Apr 2003 16:48:10 -0000 1.25
+++ xftglyphs.c 1 May 2003 00:13:17 -0000 1.26
@@ -534,9 +534,14 @@
}
else
{
- xftg->bitmap = malloc (sizergba);
- if (xftg->bitmap)
- memcpy (xftg->bitmap, bufBitmapRgba, sizergba);
+ if (sizergba)
+ {
+ xftg->bitmap = malloc (sizergba);
+ if (xftg->bitmap)
+ memcpy (xftg->bitmap, bufBitmapRgba, sizergba);
+ }
+ else
+ xftg->bitmap = 0;
}
}
else
@@ -575,9 +580,14 @@
}
else
{
- xftg->bitmap = malloc (size);
- if (xftg->bitmap)
- memcpy (xftg->bitmap, bufBitmap, size);
+ if (size)
+ {
+ xftg->bitmap = malloc (size);
+ if (xftg->bitmap)
+ memcpy (xftg->bitmap, bufBitmap, size);
+ }
+ else
+ xftg->bitmap = 0;
}
}
font->glyph_memory += xftg->glyph_memory;