diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2017-12-10 23:57:35 +0100 |
---|---|---|
committer | Mihai Moldovan <ionic@ionic.de> | 2017-12-28 00:17:54 +0100 |
commit | 6acbfab33133a92dbd7f128284d26f94bfeb1af2 (patch) | |
tree | a270c581d3268b20ef8527cffeb8ad91b26b9cf7 /nx-X11/programs/Xserver/mi | |
parent | bc5f9a2363cb865fa1a8a1427d9320514e7d1889 (diff) | |
download | nx-libs-6acbfab33133a92dbd7f128284d26f94bfeb1af2.tar.gz nx-libs-6acbfab33133a92dbd7f128284d26f94bfeb1af2.tar.bz2 nx-libs-6acbfab33133a92dbd7f128284d26f94bfeb1af2.zip |
reduce usage of uninitialised bytes
as reported by valgrind
Diffstat (limited to 'nx-X11/programs/Xserver/mi')
-rw-r--r-- | nx-X11/programs/Xserver/mi/miexpose.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/nx-X11/programs/Xserver/mi/miexpose.c b/nx-X11/programs/Xserver/mi/miexpose.c index c39221000..db7fdf010 100644 --- a/nx-X11/programs/Xserver/mi/miexpose.c +++ b/nx-X11/programs/Xserver/mi/miexpose.c @@ -395,7 +395,7 @@ miSendGraphicsExpose (client, pRgn, drawable, major, minor) numRects = RegionNumRects(pRgn); pBox = RegionRects(pRgn); - if(!(pEvent = (xEvent *)malloc(numRects * sizeof(xEvent)))) + if(!(pEvent = (xEvent *)calloc(numRects, sizeof(xEvent)))) return; pe = pEvent; @@ -417,8 +417,7 @@ miSendGraphicsExpose (client, pRgn, drawable, major, minor) } else { - xEvent event; - memset(&event, 0, sizeof(xEvent)); + xEvent event = {0}; event.u.u.type = NoExpose; event.u.noExposure.drawable = drawable; event.u.noExposure.majorEvent = major; @@ -442,9 +441,8 @@ miSendExposures(pWin, pRgn, dx, dy) pBox = RegionRects(pRgn); numRects = RegionNumRects(pRgn); - if(!(pEvent = (xEvent *) malloc(numRects * sizeof(xEvent)))) + if(!(pEvent = (xEvent *) calloc(numRects, sizeof(xEvent)))) return; - memset(pEvent, 0, numRects * sizeof(xEvent)); for (i=numRects, pe = pEvent; --i >= 0; pe++, pBox++) { @@ -658,7 +656,7 @@ int what; BITS32 gcmask, index, mask; RegionRec prgnWin; DDXPointRec oldCorner; - BoxRec box; + BoxRec box = {0}; WindowPtr pBgWin; GCPtr pGC; register int i; @@ -705,8 +703,7 @@ int what; } } - prect = (xRectangle *)malloc(RegionNumRects(prgn) * - sizeof(xRectangle)); + prect = (xRectangle *)calloc(RegionNumRects(prgn), sizeof(xRectangle)); if (!prect) return; @@ -892,8 +889,7 @@ miClearDrawable(pDraw, pGC) { XID fg = pGC->fgPixel; XID bg = pGC->bgPixel; - xRectangle rect; - + xRectangle rect = {0}; rect.x = 0; rect.y = 0; rect.width = pDraw->width; |