Bug 1431637 - free qcms_transform r_clut. r=jrmuizel
authorLee Salzman <lsalzman@mozilla.com>
Thu, 08 Feb 2018 21:41:03 -0500
changeset 752967 73255f988eb133d3f515687cead96259d6fc0bb9
parent 752966 1fa8c5b051ac7a91c3856610fe99b8af0066cb54
child 752968 94d10cf318b8f9c1b163a79afe978da9e47f01a8
push id98429
push usermak77@bonardo.net
push dateFri, 09 Feb 2018 10:14:12 +0000
reviewersjrmuizel
bugs1431637
milestone60.0a1
Bug 1431637 - free qcms_transform r_clut. r=jrmuizel MozReview-Commit-ID: DwbIhtuGvcA
gfx/qcms/transform.c
--- a/gfx/qcms/transform.c
+++ b/gfx/qcms/transform.c
@@ -990,16 +990,20 @@ void qcms_transform_release(qcms_transfo
 		free(t->input_gamma_table_b);
 
 	free(t->input_gamma_table_gray);
 
 	free(t->output_gamma_lut_r);
 	free(t->output_gamma_lut_g);
 	free(t->output_gamma_lut_b);
 
+	/* r_clut points to beginning of buffer allocated in qcms_transform_precacheLUT_float */
+	if (t->r_clut)
+		free(t->r_clut);
+
 	transform_free(t);
 }
 
 #ifdef X86
 // Determine if we can build with SSE2 (this was partly copied from jmorecfg.h in
 // mozilla/jpeg)
  // -------------------------------------------------------------------------
 #if defined(_M_IX86) && defined(_MSC_VER)
@@ -1186,16 +1190,17 @@ qcms_transform* qcms_transform_precacheL
 			} else {
 				transform->transform_fn = qcms_transform_data_tetra_clut;
 			}
 		}
 	}
 
 
 	//XXX: qcms_modular_transform_data may return either the src or dest buffer. If so it must not be free-ed
+	// It will be stored in r_clut, which will be cleaned up in qcms_transform_release.
 	if (src && lut != src) {
 		free(src);
 	}
 	if (dest && lut != dest) {
 		free(dest);
 	}
 
 	if (lut == NULL) {