Fix minor valgrind-found memory leaks
https://codereview.chromium.org/12440066/
git-svn-id: http://skia.googlecode.com/svn/trunk@8297 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp
index c4cffea..b25979c 100644
--- a/src/effects/SkMatrixConvolutionImageFilter.cpp
+++ b/src/effects/SkMatrixConvolutionImageFilter.cpp
@@ -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,