From 31b2bb91009092ee3746571b83ced874ec7aaa43 Mon Sep 17 00:00:00 2001 From: Ingo Date: Tue, 28 May 2013 15:37:05 +0200 Subject: [PATCH] Fixes double free or corruption (out) when using Noise Reduction, Issue 1887 --- rtengine/FTblockDN.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rtengine/FTblockDN.cc b/rtengine/FTblockDN.cc index a556e1f4e..73c23a4cf 100644 --- a/rtengine/FTblockDN.cc +++ b/rtengine/FTblockDN.cc @@ -258,7 +258,10 @@ namespace rtengine { // Calculate number of tiles. If less than omp_get_max_threads(), then limit num_threads to number of tiles int numtiles = numtiles_W * numtiles_H; int numthreads = MIN(numtiles,omp_get_max_threads()); - if(options.rgbDenoiseThreadLimit > 0) numthreads = MIN(numthreads,options.rgbDenoiseThreadLimit); + if(options.rgbDenoiseThreadLimit > 0) numthreads = MIN(numthreads,options.rgbDenoiseThreadLimit); + // Issue 1887, overide setting of 1, if more than one thread is available. This way the inner omp-directives should become inactive + if(numthreads == 1 && omp_get_max_threads() > 1) + numthreads = 2; #pragma omp parallel num_threads(numthreads) #endif {