summaryrefslogtreecommitdiff
authorSam Spilsbury <smspillaz@gmail.com>2010-02-07 12:09:45 (GMT)
committer Sam Spilsbury <smspillaz@gmail.com>2010-02-07 12:09:45 (GMT)
commitd19d863de3eeb536a5701377e20f25df09208e16 (patch) (side-by-side diff)
tree7c110485f182d5d5f3df9368881220e120b2703a
parenta8255c85207f5dd150162c0df6fe20bef3caee6c (diff)
downloadgroup-d19d863de3eeb536a5701377e20f25df09208e16.tar.gz
group-d19d863de3eeb536a5701377e20f25df09208e16.tar.bz2
Don't use array new[] directly.
There are bugs when conducting operators within the array [] syntax for new so precalculate the desired size first and then call array new[]
-rw-r--r--src/cairo.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/cairo.cpp b/src/cairo.cpp
index 7109071..cdad0fc 100644
--- a/src/cairo.cpp
+++ b/src/cairo.cpp
@@ -107,7 +107,8 @@ CairoHelper::init (int width, int height)
{
try
{
- buffer = new unsigned char[4 * width * height];
+ int size = 4 * width * height;
+ buffer = new unsigned char[size];
}
catch (std::bad_alloc)
{
@@ -136,7 +137,7 @@ CairoHelper::init (int width, int height)
{
compLogMessage ("group", CompLogLevelError,
"Failed to create cairo layer context.");
- delete [] buffer;
+ delete[] buffer;
buffer = NULL;
cairo_surface_destroy (surface);
surface = NULL;