summaryrefslogtreecommitdiff
path: root/dix/glyphcurs.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2015-03-21 11:07:24 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2015-04-21 16:57:07 -0700
commitf3ba909753cd216fc9eca4618a76cc283ccbf51e (patch)
tree1b48b1c08c341b26ed8d74e339308893021dccbe /dix/glyphcurs.c
parenta28202a148508837911c5932a0d14af4b145bece (diff)
Let calloc handle multiplication
It's going to multiply anyway, so if we have non-constant values, might as well let it do the multiplication instead of adding another multiply, and good versions of calloc will check for & avoid overflow in the process. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'dix/glyphcurs.c')
-rw-r--r--dix/glyphcurs.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/dix/glyphcurs.c b/dix/glyphcurs.c
index eca6a4cb8..3ff6ae83e 100644
--- a/dix/glyphcurs.c
+++ b/dix/glyphcurs.c
@@ -78,7 +78,6 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm,
GCPtr pGC;
xRectangle rect;
PixmapPtr ppix;
- long nby;
char *pbits;
ChangeGCVal gcval[3];
unsigned char char2b[2];
@@ -88,8 +87,7 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm,
char2b[1] = (unsigned char) (ch & 0xff);
pScreen = screenInfo.screens[0];
- nby = BitmapBytePad(cm->width) * (long) cm->height;
- pbits = calloc(1, nby);
+ pbits = calloc(BitmapBytePad(cm->width), cm->height);
if (!pbits)
return BadAlloc;