diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-23 10:41:45 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-23 11:45:23 +0200 |
commit | 6122f6266c61db851d7595aeb824502172b509b2 (patch) | |
tree | 2aa0f7fa5c9fb0e9acd5f5602ef0cc5f86824dc7 /include | |
parent | 6a068a90bb8b7625aca73e2c7c0a9e14a95b82be (diff) |
fix memory management in BitmapConvolutionMatrixFilter
was deleting a stack allocated buffer.
Also
(*) drop the BitmapConvolutionMatrixFilter default constructor, the
current code does not permit mpMatrix to be nullptr
(*) declare the mpMatrix field as a reference to a fixed length array,
to be more precise
(*) pass the array in the constructor so that call sites will be
properly type- and length-checked.
Change-Id: I650d56cdfac0dae4ea77df7c0c03e19d658c00c8
Reviewed-on: https://gerrit.libreoffice.org/53312
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/vcl/BitmapConvolutionMatrixFilter.hxx | 13 | ||||
-rw-r--r-- | include/vcl/BitmapSharpenFilter.hxx | 6 |
2 files changed, 4 insertions, 15 deletions
diff --git a/include/vcl/BitmapConvolutionMatrixFilter.hxx b/include/vcl/BitmapConvolutionMatrixFilter.hxx index a2189326322b..cae8c3d8a91c 100644 --- a/include/vcl/BitmapConvolutionMatrixFilter.hxx +++ b/include/vcl/BitmapConvolutionMatrixFilter.hxx @@ -20,22 +20,15 @@ class BitmapEx; class VCL_DLLPUBLIC BitmapConvolutionMatrixFilter : public BitmapFilter { public: - BitmapConvolutionMatrixFilter() - : mpMatrix(nullptr) + BitmapConvolutionMatrixFilter(const long (&rMatrix)[9]) + : mrMatrix(rMatrix) { } - BitmapConvolutionMatrixFilter(const long* pMatrix) - : mpMatrix(pMatrix) - { - } - - ~BitmapConvolutionMatrixFilter() override { delete mpMatrix; } - virtual BitmapEx execute(BitmapEx const& rBitmapEx) override; protected: - const long* mpMatrix; + const long (&mrMatrix)[9]; }; #endif diff --git a/include/vcl/BitmapSharpenFilter.hxx b/include/vcl/BitmapSharpenFilter.hxx index 7e965976d5e8..66cb56f3a1d5 100644 --- a/include/vcl/BitmapSharpenFilter.hxx +++ b/include/vcl/BitmapSharpenFilter.hxx @@ -16,11 +16,7 @@ class VCL_DLLPUBLIC BitmapSharpenFilter : public BitmapConvolutionMatrixFilter { public: - BitmapSharpenFilter() - { - const long pSharpenMatrix[] = { -1, -1, -1, -1, 16, -1, -1, -1, -1 }; - mpMatrix = &pSharpenMatrix[0]; - } + BitmapSharpenFilter(); }; #endif |