From 0815682bfc3032480aeaf88cab9f00f65c6d3878 Mon Sep 17 00:00:00 2001 From: Allanis Date: Thu, 16 May 2013 15:35:57 +0100 Subject: [PATCH] [Fix] Slight plasma fractal issue. --- src/plasmaf.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plasmaf.c b/src/plasmaf.c index 2aea832..f7268cb 100644 --- a/src/plasmaf.c +++ b/src/plasmaf.c @@ -45,6 +45,10 @@ static double* pf_genFractalMap(const int w, const int h, double rug) { double cx, cy; map = malloc(w*h * sizeof(double)); + if(map == NULL) { + WARN("Out of memory"); + return NULL; + } // Set up initial values. cx = (double)w/2; @@ -93,7 +97,6 @@ static void pf_divFractal(double* map, const double x, const double y, pf_divFractal(map, x, y+nh, nw, nh, rw, rh, e4, m, e3, c4, rug); } else // Actually write the pixel. - //map[y*rw+x] = (c1 + c2 + c3 + c4)/4.; - map[(int)round(y)*(int)rw+(int)round(x)] = (c1 + c2 + c3 + c4)/4.; + map[(int)y*(int)rw + (int)x] = (c1 + c2 + c3 + c4)/4.; }