[graphics/krita] plugins/generators/simplexnoise: Fix resource leak
Boudewijn Rempt
null at kde.org
Wed Oct 7 13:15:39 BST 2020
Git commit befdf9b4d74389c767cf558c183e9f82a30c0c58 by Boudewijn Rempt.
Committed on 07/10/2020 at 12:11.
Pushed by rempt into branch 'master'.
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
M +2 -2 plugins/generators/simplexnoise/simplexnoisegenerator.cpp
https://invent.kde.org/graphics/krita/commit/befdf9b4d74389c767cf558c183e9f82a30c0c58
diff --git a/plugins/generators/simplexnoise/simplexnoisegenerator.cpp b/plugins/generators/simplexnoise/simplexnoisegenerator.cpp
index 16f6ccbfa6..d67c8ae5e5 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