Commit 7ba1bce1 authored by Aloshi's avatar Aloshi

Assert malloc() calls do not return NULL.

parent 3eda72b8
...@@ -30,6 +30,7 @@ void SVGResource::initFromMemory(const char* file, size_t length) ...@@ -30,6 +30,7 @@ void SVGResource::initFromMemory(const char* file, size_t length)
// nsvgParse excepts a modifiable, null-terminated string // nsvgParse excepts a modifiable, null-terminated string
char* copy = (char*)malloc(length + 1); char* copy = (char*)malloc(length + 1);
assert(copy != NULL);
memcpy(copy, file, length); memcpy(copy, file, length);
copy[length] = '\0'; copy[length] = '\0';
...@@ -70,6 +71,7 @@ void SVGResource::rasterizeAt(size_t width, size_t height) ...@@ -70,6 +71,7 @@ void SVGResource::rasterizeAt(size_t width, size_t height)
} }
unsigned char* imagePx = (unsigned char*)malloc(width * height * 4); unsigned char* imagePx = (unsigned char*)malloc(width * height * 4);
assert(imagePx != NULL);
NSVGrasterizer* rast = nsvgCreateRasterizer(); NSVGrasterizer* rast = nsvgCreateRasterizer();
nsvgRasterize(rast, mSVGImage, 0, 0, height / mSVGImage->height, imagePx, width, height, width * 4); nsvgRasterize(rast, mSVGImage, 0, 0, height / mSVGImage->height, imagePx, width, height, width * 4);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment