From 55b27ed70cf9dfa9b9dffe46e9a3191bfda38f7c Mon Sep 17 00:00:00 2001 From: Andreas Hartmetz Date: Sat, 4 Oct 2014 18:13:04 +0200 Subject: glamor: Don't free memory we are going to use. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Keith Packard --- glamor/glamor_pixmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'glamor/glamor_pixmap.c') 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; -- cgit v1.2.3