diff --git a/src/Platform.cpp b/src/Platform.cpp index 40d17f1056..08c0b19dff 100644 --- a/src/Platform.cpp +++ b/src/Platform.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #ifdef WIN #include #include @@ -31,7 +32,9 @@ char *ExecutableName(void) uint32_t max = 64, res; if (_NSGetExecutablePath(fn, &max) != 0) { - fn = (char*)realloc(fn, max); + char *realloced_fn = (char*)realloc(fn, max); + assert(realloced_fn != NULL); + fn = realloced_fn; _NSGetExecutablePath(fn, &max); } if (realpath(fn, name) == NULL) @@ -51,7 +54,9 @@ char *ExecutableName(void) #endif #ifndef MACOSX max *= 2; - name = (char *)realloc(name, max); + char* realloced_name = (char *)realloc(name, max); + assert(realloced_name != NULL); + name = realloced_name; memset(name, 0, max); } #endif diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index d4217c9f51..1010a200b5 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -1010,8 +1010,10 @@ void Simulation::ApplyDecorationFill(Renderer *ren, int x, int y, int colR, int return; memset(bitmap, 0, XRES*YRES); - if (!ColorCompare(ren, x, y, replaceR, replaceG, replaceB)) + if (!ColorCompare(ren, x, y, replaceR, replaceG, replaceB)) { + free(bitmap); return; + } try {