glamor: Fix memory leak in _glamor_copy_n_to_n()

It would leak the memory allocated for the region rects in some cases.
Found with valgrind.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Michel Dänzer 2014-04-23 18:54:42 +09:00 committed by Eric Anholt
parent 4e9aabb6fc
commit 21e0e37385

View File

@ -367,7 +367,7 @@ _glamor_copy_n_to_n(DrawablePtr src,
goto fall_back; goto fall_back;
glamor_make_current(glamor_priv); glamor_make_current(glamor_priv);
if (!glamor_set_alu(screen, gc->alu)) { 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) if (n_dst_region == 0)
ok = TRUE; ok = TRUE;
free(clipped_dst_regions); free(clipped_dst_regions);
RegionUninit(&region);
} }
else { else {
ok = __glamor_copy_n_to_n(src, dst, gc, box, nbox, dx, dy, 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: fail:
RegionUninit(&region);
fail_noregion:
glamor_make_current(glamor_priv); glamor_make_current(glamor_priv);
glamor_set_alu(screen, GXcopy); glamor_set_alu(screen, GXcopy);