From 2ac2fc0de978ba7076ba7c5e3c34caec05939dde Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Wed, 15 Jan 2014 16:32:10 +0900 Subject: Fix memory leak in _glamor_copy_n_to_n() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It would leak the memory allocated for the region rects in some cases. Found with valgrind. Signed-off-by: Michel Dänzer Reviewed-by: Alex Deucher Reviewed-by: Zhigang Gong --- src/glamor_copyarea.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/glamor_copyarea.c b/src/glamor_copyarea.c index 4e6f953..bde6b4f 100644 --- a/src/glamor_copyarea.c +++ b/src/glamor_copyarea.c @@ -427,7 +427,7 @@ _glamor_copy_n_to_n(DrawablePtr src, dispatch = glamor_get_dispatch(glamor_priv); if (!glamor_set_alu(dispatch, gc->alu)) { glamor_put_dispatch(glamor_priv); - goto fail; + goto fail_noregion; } glamor_put_dispatch(glamor_priv); } @@ -577,7 +577,6 @@ _glamor_copy_n_to_n(DrawablePtr src, if (n_dst_region == 0) ok = TRUE; free(clipped_dst_regions); - RegionUninit(®ion); } else { ok = __glamor_copy_n_to_n(src, dst, gc, box, nbox, dx, dy, reverse, upsidedown, bitplane, @@ -585,6 +584,8 @@ _glamor_copy_n_to_n(DrawablePtr src, } fail: + RegionUninit(®ion); +fail_noregion: dispatch = glamor_get_dispatch(glamor_priv); glamor_set_alu(dispatch, GXcopy); glamor_put_dispatch(glamor_priv); -- cgit v1.2.3