summaryrefslogtreecommitdiffstats
path: root/src/trace/imagemap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/trace/imagemap.cpp')
-rw-r--r--src/trace/imagemap.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/trace/imagemap.cpp b/src/trace/imagemap.cpp
index a9ad9b9c8..c5a6bc2b5 100644
--- a/src/trace/imagemap.cpp
+++ b/src/trace/imagemap.cpp
@@ -78,10 +78,16 @@ GrayMap *GrayMapCreate(int width, int height)
me->height = height;
me->pixels = (unsigned long *)
malloc(sizeof(unsigned long) * width * height);
+ if (!me->pixels)
+ {
+ free(me);
+ return NULL;
+ }
me->rows = (unsigned long **)
malloc(sizeof(unsigned long *) * height);
- if (!me->pixels || !me->rows)
+ if (!me->rows)
{
+ free(me->pixels);
free(me);
return NULL;
}