summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Hartmetz <ahartmetz@gmail.com>2014-10-04 18:13:04 +0200
committerKeith Packard <keithp@keithp.com>2014-10-26 17:00:17 -0700
commit55b27ed70cf9dfa9b9dffe46e9a3191bfda38f7c (patch)
treedb1fd716342996d21c41fc3ab31d64f194738f8f
parent16a32c53f6e9ad1f3284d4596edfa33e9efb740e (diff)
glamor: Don't free memory we are going to use.
glamor_color_convert_to_bits() returns its second argument on success, NULL on error, and need_free_bits already makes sure that "bits" aliasing converted_bits is freed in the success case. Looks like the memory leak that was supposed to be fixed in 6e50bfa706cd3ab884c933bf1f17c221a6208aa4 only occurred in the error case. Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--glamor/glamor_pixmap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/glamor/glamor_pixmap.c b/glamor/glamor_pixmap.c
index 355fe4b57..7c9bf2640 100644
--- a/glamor/glamor_pixmap.c
+++ b/glamor/glamor_pixmap.c
@@ -774,8 +774,8 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
return FALSE;
bits = glamor_color_convert_to_bits(bits, converted_bits, w, h,
stride, no_alpha, revert, swap_rb);
- free(converted_bits);
if (bits == NULL) {
+ free(converted_bits);
ErrorF("Failed to convert pixmap no_alpha %d,"
"revert mode %d, swap mode %d\n", no_alpha, revert, swap_rb);
return FALSE;