Assert malloc() calls do not return NULL.

This commit is contained in:
Aloshi 2014-05-23 19:03:10 -05:00
parent 3eda72b82b
commit 7ba1bce133

View file

@ -30,6 +30,7 @@ void SVGResource::initFromMemory(const char* file, size_t length)
// nsvgParse excepts a modifiable, null-terminated string
char* copy = (char*)malloc(length + 1);
assert(copy != NULL);
memcpy(copy, file, length);
copy[length] = '\0';
@ -70,6 +71,7 @@ void SVGResource::rasterizeAt(size_t width, size_t height)
}
unsigned char* imagePx = (unsigned char*)malloc(width * height * 4);
assert(imagePx != NULL);
NSVGrasterizer* rast = nsvgCreateRasterizer();
nsvgRasterize(rast, mSVGImage, 0, 0, height / mSVGImage->height, imagePx, width, height, width * 4);