From 21e0e373858bd7f3458172ebd465397e33b90162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Wed, 23 Apr 2014 18:54:42 +0900 Subject: [PATCH] glamor: 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. Reviewed-by: Alex Deucher Reviewed-by: Zhigang Gong Signed-off-by: Michel Dänzer Signed-off-by: Eric Anholt --- glamor/glamor_copyarea.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/glamor/glamor_copyarea.c b/glamor/glamor_copyarea.c index 6e90e36f3..e1988225f 100644 --- a/glamor/glamor_copyarea.c +++ b/glamor/glamor_copyarea.c @@ -367,7 +367,7 @@ _glamor_copy_n_to_n(DrawablePtr src, goto fall_back; glamor_make_current(glamor_priv); if (!glamor_set_alu(screen, gc->alu)) { - goto fail; + goto fail_noregion; } } @@ -533,7 +533,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, @@ -541,6 +540,8 @@ _glamor_copy_n_to_n(DrawablePtr src, } fail: + RegionUninit(®ion); + fail_noregion: glamor_make_current(glamor_priv); glamor_set_alu(screen, GXcopy);