mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-26 16:15:39 +00:00
Assert malloc() calls do not return NULL.
This commit is contained in:
parent
3eda72b82b
commit
7ba1bce133
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|
Loading…
Reference in a new issue