[graphics/krita/krita/4.4.0] plugins/generators/simplexnoise: Fix resource leak
Dmitry Kazakov
null at kde.org
Mon Oct 12 10:03:09 BST 2020
Git commit 3172f1da31e00550016f54851568c15c8c793596 by Dmitry Kazakov, on behalf of Boudewijn Rempt.
Committed on 12/10/2020 at 09:02.
Pushed by dkazakov into branch 'krita/4.4.0'.
Fix resource leak
This is why I do not want auto to be used in Krita's code:
auto bla = createSomething();
doesn't warn that you need to delete bla as much as
Bla *bla = createSomething();
because it's invisible that bla is a pointer.
The alternative is that we use smart pointers _everywhere_, which
isn't feasible...
CCMAIL:kimageshop at kde.org
CID:305464
(cherry picked from commit befdf9b4d74389c767cf558c183e9f82a30c0c58)
M +2 -2 plugins/generators/simplexnoise/simplexnoisegenerator.cpp
https://invent.kde.org/graphics/krita/commit/3172f1da31e00550016f54851568c15c8c793596
diff --git a/plugins/generators/simplexnoise/simplexnoisegenerator.cpp b/plugins/generators/simplexnoise/simplexnoisegenerator.cpp
index bf97c34a7c..0562c7f61a 100644
--- a/plugins/generators/simplexnoise/simplexnoisegenerator.cpp
+++ b/plugins/generators/simplexnoise/simplexnoisegenerator.cpp
@@ -65,7 +65,7 @@ void KisSimplexNoiseGenerator::generate(KisProcessingInformation dst, const QSiz
const KoColorSpace *cs = device->colorSpace();
const KoColorSpace *src = KoColorSpaceRegistry::instance()->colorSpace(GrayAColorModelID.id(), Float32BitsColorDepthID.id(), "Gray-D50-elle-V2-srgbtrc.icc");
- auto conv = KoColorSpaceRegistry::instance()->createColorConverter(src, cs, KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::internalConversionFlags());
+ KoColorConversionTransformation *conv = KoColorSpaceRegistry::instance()->createColorConverter(src, cs, KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::internalConversionFlags());
KisSequentialIteratorProgress it(device, bounds, progressUpdater);
@@ -117,7 +117,7 @@ void KisSimplexNoiseGenerator::generate(KisProcessingInformation dst, const QSiz
conv->transform(c.data(), it.rawData(), 1);
}
}
-
+ delete conv;
open_simplex_noise_free(noise_context);
}
More information about the kimageshop
mailing list