diff options
author | Marti Maria <marti.maria@littlecms.com> | 2018-12-16 16:57:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-16 16:57:15 +0100 |
commit | 239fc8734f180f0847d4405f32dd1459ee30ba98 (patch) | |
tree | a38aa4e7d32f9df07685b5e1520179111369f89a | |
parent | 8005ab02c3be0680fecc7c86d719b6c2545b5671 (diff) | |
parent | a0e6c1931b05ec644199306450822a36be8bb39d (diff) | |
download | lcms2-239fc8734f180f0847d4405f32dd1459ee30ba98.tar.gz |
Merge pull request #176 from sebras/master
Fix double free of curve data structure.
Looks great, thank you!
-rw-r--r-- | src/cmsopt.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/cmsopt.c b/src/cmsopt.c index 3cbec78..6be5878 100644 --- a/src/cmsopt.c +++ b/src/cmsopt.c @@ -1438,27 +1438,26 @@ cmsBool OptimizeByJoiningCurves(cmsPipeline** Lut, cmsUInt32Number Intent, cmsUI // Maybe the curves are linear at the end if (!AllCurvesAreLinear(ObtainedCurves)) { + _cmsStageToneCurvesData* Data; if (!cmsPipelineInsertStage(Dest, cmsAT_BEGIN, ObtainedCurves)) goto Error; + Data = (_cmsStageToneCurvesData*) cmsStageData(ObtainedCurves); + ObtainedCurves = NULL; // If the curves are to be applied in 8 bits, we can save memory if (_cmsFormatterIs8bit(*InputFormat)) { - - _cmsStageToneCurvesData* Data = (_cmsStageToneCurvesData*) ObtainedCurves ->Data; Curves16Data* c16 = CurvesAlloc(Dest ->ContextID, Data ->nCurves, 256, Data ->TheCurves); - if (c16 == NULL) goto Error; + if (c16 == NULL) goto Error; *dwFlags |= cmsFLAGS_NOCACHE; _cmsPipelineSetOptimizationParameters(Dest, FastEvaluateCurves8, c16, CurvesFree, CurvesDup); } else { - - _cmsStageToneCurvesData* Data = (_cmsStageToneCurvesData*) cmsStageData(ObtainedCurves); Curves16Data* c16 = CurvesAlloc(Dest ->ContextID, Data ->nCurves, 65536, Data ->TheCurves); - if (c16 == NULL) goto Error; + if (c16 == NULL) goto Error; *dwFlags |= cmsFLAGS_NOCACHE; _cmsPipelineSetOptimizationParameters(Dest, FastEvaluateCurves16, c16, CurvesFree, CurvesDup); } |