summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2014-01-15 16:32:10 +0900
committerZhigang Gong <zhigang.gong@gmail.com>2014-01-17 00:03:21 +0800
commit2ac2fc0de978ba7076ba7c5e3c34caec05939dde (patch)
tree4428e7421c7112971aaccd1d4bbab751434f9c36
parent580aa0524a99ce80d3f556de4aa1a10b1f7f8de4 (diff)
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. Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
-rw-r--r--src/glamor_copyarea.c5
1 files 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(&region);
} 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(&region);
+fail_noregion:
dispatch = glamor_get_dispatch(glamor_priv);
glamor_set_alu(dispatch, GXcopy);
glamor_put_dispatch(glamor_priv);