From 89a909599b8e9747717419ebbda5796471aada27 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Tue, 23 Apr 2013 22:16:08 +0200 Subject: Fix memory leak. --- plugingui/pixelbuffer.cc | 10 ++++++++++ plugingui/pixelbuffer.h | 2 ++ 2 files changed, 12 insertions(+) (limited to 'plugingui') diff --git a/plugingui/pixelbuffer.cc b/plugingui/pixelbuffer.cc index a593f9e..e58658b 100644 --- a/plugingui/pixelbuffer.cc +++ b/plugingui/pixelbuffer.cc @@ -34,6 +34,11 @@ GUI::PixelBuffer::PixelBuffer(size_t width, size_t height) realloc(width, height); } +GUI::PixelBuffer::~PixelBuffer() +{ + if(buf) free(buf); +} + void GUI::PixelBuffer::realloc(size_t width, size_t height) { if(buf) free(buf); @@ -79,6 +84,11 @@ GUI::PixelBufferAlpha::PixelBufferAlpha(size_t width, size_t height) realloc(width, height); } +GUI::PixelBufferAlpha::~PixelBufferAlpha() +{ + if(buf) free(buf); +} + void GUI::PixelBufferAlpha::realloc(size_t width, size_t height) { if(buf) free(buf); diff --git a/plugingui/pixelbuffer.h b/plugingui/pixelbuffer.h index 2b73503..2785eb1 100644 --- a/plugingui/pixelbuffer.h +++ b/plugingui/pixelbuffer.h @@ -36,6 +36,7 @@ namespace GUI { class PixelBuffer { public: PixelBuffer(size_t width, size_t height); + ~PixelBuffer(); void realloc(size_t width, size_t height); @@ -53,6 +54,7 @@ public: class PixelBufferAlpha { public: PixelBufferAlpha(size_t width, size_t height); + ~PixelBufferAlpha(); int idx; size_t x, y; -- cgit v1.2.3