diff options
author | Mikhail Gusarov <dottedmag@dottedmag.net> | 2010-06-06 15:28:30 +0700 |
---|---|---|
committer | Mikhail Gusarov <dottedmag@dottedmag.net> | 2010-06-06 20:27:18 +0700 |
commit | 0a4d8cbdcd7b25313fb29ccdb498044af95f7de6 (patch) | |
tree | 3534c9035180b7e0d2ebbbf0202a370cb61f8e8d /mi | |
parent | 5a0fc0ad21d562612676ef88ef2d533b2391810a (diff) |
Remove more superfluous if(p) checks around free(p)
This patch has been generated by the following Coccinelle semantic patch:
@@
expression E;
@@
-if(E) { free(E); }
+free(E);
Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Fernando Carrijo <fcarrijo@yahoo.com.br>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'mi')
-rw-r--r-- | mi/miarc.c | 6 | ||||
-rw-r--r-- | mi/mibitblt.c | 19 | ||||
-rw-r--r-- | mi/micopy.c | 9 | ||||
-rw-r--r-- | mi/mifillrct.c | 4 | ||||
-rw-r--r-- | mi/mifpolycon.c | 6 | ||||
-rw-r--r-- | mi/mipolycon.c | 4 | ||||
-rw-r--r-- | mi/mispans.c | 12 |
7 files changed, 23 insertions, 37 deletions
diff --git a/mi/miarc.c b/mi/miarc.c index 5143d2a88..db21165df 100644 --- a/mi/miarc.c +++ b/mi/miarc.c @@ -3081,10 +3081,8 @@ fillSpans ( (*pGC->ops->FillSpans) (pDrawable, pGC, i, xSpans, xWidths, TRUE); } disposeFinalSpans (); - if (xSpans) - free(xSpans); - if (xWidths) - free(xWidths); + free(xSpans); + free(xWidths); finalMiny = 0; finalMaxy = -1; finalSize = 0; diff --git a/mi/mibitblt.c b/mi/mibitblt.c index 844848347..98857e8ce 100644 --- a/mi/mibitblt.c +++ b/mi/mibitblt.c @@ -150,12 +150,9 @@ miCopyArea(DrawablePtr pSrcDrawable, ordering = malloc(numRects * sizeof(unsigned int)); if(!pptFirst || !pwidthFirst || !ordering) { - if (ordering) - free(ordering); - if (pwidthFirst) - free(pwidthFirst); - if (pptFirst) - free(pptFirst); + free(ordering); + free(pwidthFirst); + free(pptFirst); return NULL; } @@ -433,8 +430,8 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc, pwidth = pwidthFirst = malloc(h * sizeof(int)); if(!pptFirst || !pwidthFirst) { - if (pwidthFirst) free(pwidthFirst); - if (pptFirst) free(pptFirst); + free(pwidthFirst); + free(pptFirst); FreeScratchGC(pGCT); return; } @@ -801,10 +798,8 @@ miPutImage( DrawablePtr pDraw, GCPtr pGC, int depth, pwidth = pwidthFirst = malloc(h * sizeof(int)); if(!pptFirst || !pwidthFirst) { - if (pwidthFirst) - free(pwidthFirst); - if (pptFirst) - free(pptFirst); + free(pwidthFirst); + free(pptFirst); return; } if (pGC->miTranslate) diff --git a/mi/micopy.c b/mi/micopy.c index b1a7a0850..027c461fe 100644 --- a/mi/micopy.c +++ b/mi/micopy.c @@ -108,8 +108,7 @@ miCopyRegion (DrawablePtr pSrcDrawable, pboxNew2 = (BoxPtr)malloc(sizeof(BoxRec) * nbox); if(!pboxNew2) { - if (pboxNew1) - free(pboxNew1); + free(pboxNew1); return; } pboxBase = pboxNext = pbox; @@ -143,10 +142,8 @@ miCopyRegion (DrawablePtr pSrcDrawable, dx, dy, reverse, upsidedown, bitPlane, closure); - if (pboxNew1) - free(pboxNew1); - if (pboxNew2) - free(pboxNew2); + free(pboxNew1); + free(pboxNew2); } RegionPtr diff --git a/mi/mifillrct.c b/mi/mifillrct.c index e2bd7c913..1c63a35fa 100644 --- a/mi/mifillrct.c +++ b/mi/mifillrct.c @@ -111,8 +111,8 @@ miPolyFillRect( pwFirst = malloc(maxheight * sizeof(int)); if(!pptFirst || !pwFirst) { - if (pwFirst) free(pwFirst); - if (pptFirst) free(pptFirst); + free(pwFirst); + free(pptFirst); return; } diff --git a/mi/mifpolycon.c b/mi/mifpolycon.c index 13b5a4872..1be01500a 100644 --- a/mi/mifpolycon.c +++ b/mi/mifpolycon.c @@ -122,9 +122,9 @@ miFillSppPoly( if(!ptsOut || !width || !Marked) { - if (Marked) free(Marked); - if (width) free(width); - if (ptsOut) free(ptsOut); + free(Marked); + free(width); + free(ptsOut); return; } diff --git a/mi/mipolycon.c b/mi/mipolycon.c index 40671df16..2404c56ef 100644 --- a/mi/mipolycon.c +++ b/mi/mipolycon.c @@ -109,8 +109,8 @@ miFillConvexPoly( width = FirstWidth = malloc(sizeof(int) * dy); if(!FirstPoint || !FirstWidth) { - if (FirstWidth) free(FirstWidth); - if (FirstPoint) free(FirstPoint); + free(FirstWidth); + free(FirstPoint); return(FALSE); } diff --git a/mi/mispans.c b/mi/mispans.c index 8ac66cc77..9f56e3c3d 100644 --- a/mi/mispans.c +++ b/mi/mispans.c @@ -410,10 +410,8 @@ void miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup *spanGroup) if (!yspans || !ysizes) { - if (yspans) - free(yspans); - if (ysizes) - free(ysizes); + free(yspans); + free(ysizes); miDisposeSpanGroup (spanGroup); return; } @@ -492,10 +490,8 @@ void miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup *spanGroup) } free(yspans); free(ysizes); - if (points) - free(points); - if (widths) - free(widths); + free(points); + free(widths); return; } count = 0; |