Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Unified Diff: src/effects/SkMatrixConvolutionImageFilter.cpp

Issue 12440066: Fix minor valgrind-found memory leaks (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Addressed code review issues Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkRefDict.cpp ('k') | tests/Matrix44Test.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkMatrixConvolutionImageFilter.cpp
===================================================================
--- src/effects/SkMatrixConvolutionImageFilter.cpp (revision 8291)
+++ src/effects/SkMatrixConvolutionImageFilter.cpp (working copy)
@@ -539,9 +539,9 @@
int width = random->nextRangeU(1, MAX_KERNEL_SIZE);
int height = random->nextRangeU(1, MAX_KERNEL_SIZE / width);
SkISize kernelSize = SkISize::Make(width, height);
- SkScalar* kernel = new SkScalar[width * height];
+ SkAutoTDeleteArray<SkScalar> kernel(new SkScalar[width * height]);
for (int i = 0; i < width * height; i++) {
- kernel[i] = random->nextSScalar1();
+ kernel.get()[i] = random->nextSScalar1();
}
SkScalar gain = random->nextSScalar1();
SkScalar bias = random->nextSScalar1();
@@ -551,13 +551,12 @@
bool convolveAlpha = random->nextBool();
return GrMatrixConvolutionEffect::Create(textures[texIdx],
kernelSize,
- kernel,
+ kernel.get(),
gain,
bias,
target,
tileMode,
convolveAlpha);
-
}
bool SkMatrixConvolutionImageFilter::asNewEffect(GrEffectRef** effect,
« no previous file with comments | « src/core/SkRefDict.cpp ('k') | tests/Matrix44Test.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698