@@ -271,19 +271,15 @@ static void _refine_with_detail_mask(dt_iop_module_t *self,
271271 const gboolean detail = (level > 0.0f );
272272 const float threshold = _detail_mask_threshold (level , detail );
273273
274- float * lum = NULL ;
275- float * warp_mask = NULL ;
276-
277274 dt_dev_pixelpipe_t * p = piece -> pipe ;
278275 if (p -> scharr .data == NULL ) goto error ;
279276
280- lum = dt_masks_calc_detail_mask (piece , threshold , detail );
281- if (! lum ) goto error ;
277+ float * lum = dt_masks_calc_detail_mask (piece , threshold , detail );
278+ if (lum == NULL ) goto error ;
282279
283280 // here we have the slightly blurred full detail mask available
284- warp_mask = dt_dev_distort_detail_mask (piece , lum , self );
281+ float * warp_mask = dt_dev_distort_detail_mask (piece , lum , self );
285282 dt_free_align (lum );
286- lum = NULL ;
287283
288284 if (warp_mask == NULL ) goto error ;
289285
@@ -304,8 +300,6 @@ static void _refine_with_detail_mask(dt_iop_module_t *self,
304300 "refine with detail mask" ,
305301 piece -> pipe , self , DT_DEVICE_CPU , roi_in , roi_out , "no mask data available" );
306302 dt_control_log (_ ("detail mask blending error" ));
307- dt_free_align (warp_mask );
308- dt_free_align (lum );
309303}
310304
311305static size_t
@@ -884,13 +878,12 @@ static void _refine_with_detail_mask_cl(dt_iop_module_t *self,
884878
885879 // here we have the slightly blurred full detail mask available
886880 float * warp_mask = dt_dev_distort_detail_mask (piece , lum , self );
881+ dt_free_align (lum );
887882 if (warp_mask == NULL )
888883 {
889884 err = DT_OPENCL_PROCESS_CL ;
890885 goto error ;
891886 }
892- dt_free_align (lum );
893-
894887 dt_print_pipe (DT_DEBUG_PIPE ,
895888 "refine with detail mask" ,
896889 piece -> pipe , self , piece -> pipe -> devid , roi_in , roi_out );
@@ -909,7 +902,6 @@ static void _refine_with_detail_mask_cl(dt_iop_module_t *self,
909902 "refine with detail_mask" ,
910903 piece -> pipe , self , piece -> pipe -> devid , roi_in , roi_out , "OpenCL error: %s" , cl_errstr (err ));
911904
912- dt_free_align (lum );
913905 dt_opencl_release_mem_object (tmp );
914906 dt_opencl_release_mem_object (blur );
915907 dt_opencl_release_mem_object (out );
0 commit comments