diff options
author | Tiago Vignatti <tiago.vignatti@nokia.com> | 2011-03-29 18:22:50 +0300 |
---|---|---|
committer | Tiago Vignatti <tiago.vignatti@nokia.com> | 2011-04-04 15:47:58 +0300 |
commit | bc61787a20e7683cbc4dfa45fe855da98a8c0cd0 (patch) | |
tree | bbd21e7899524d21b582c0823b60885b8cacd601 | |
parent | 45b6667b651a0a26b17f64c9e99d70784045e4bf (diff) |
render: fix memory leaks in ProcRenderCompositeGlyphs
Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Nicolas Peninguy <nico@lostgeeks.org>
Reviewed-by: Soren Sandmann <ssp@redhat.com>
-rw-r--r-- | render/render.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/render/render.c b/render/render.c index 8ff8ee6f6..c5da6d78f 100644 --- a/render/render.c +++ b/render/render.c @@ -1374,4 +1374,6 @@ ProcRenderCompositeGlyphs (ClientPtr client) listsBase = (GlyphListPtr) malloc(nlist * sizeof (GlyphListRec)); - if (!listsBase) - return BadAlloc; + if (!listsBase) { + rc = BadAlloc; + goto bail; + } } @@ -1394,9 +1396,3 @@ ProcRenderCompositeGlyphs (ClientPtr client) if (rc != Success) - { - if (glyphsBase != glyphsLocal) - free(glyphsBase); - if (listsBase != listsLocal) - free(listsBase); - return rc; - } + goto bail; } @@ -1438,4 +1434,6 @@ ProcRenderCompositeGlyphs (ClientPtr client) } - if (buffer > end) - return BadLength; + if (buffer > end) { + rc = BadLength; + goto bail; + } @@ -1450,3 +1448,5 @@ ProcRenderCompositeGlyphs (ClientPtr client) glyphsBase); + rc = Success; +bail: if (glyphsBase != glyphsLocal) @@ -1455,4 +1455,3 @@ ProcRenderCompositeGlyphs (ClientPtr client) free(listsBase); - - return Success; + return rc; } |