mirror of https://github.com/OpenRCT2/OpenRCT2.git
Keep track of address returned by malloc to free it correctly
When doing g2 generation on Linux, src variable was not modified in the same way as on Windows, which caused free() on a pointer that was not malloc()ed. This fixes #2219.
This commit is contained in:
parent
b5b1957f58
commit
6723f51087
|
@ -264,6 +264,7 @@ bool sprite_file_import(const char *path, rct_g1_element *outElement, uint8 **ou
|
|||
|
||||
// A larger range is needed for proper dithering
|
||||
sint16 *src = malloc(height * width * 4 * 2);
|
||||
sint16 *src_orig = src;
|
||||
for (uint32 x = 0; x < height * width * 4; x++){
|
||||
src[x] = (sint16) pixels[x];
|
||||
}
|
||||
|
@ -375,7 +376,7 @@ bool sprite_file_import(const char *path, rct_g1_element *outElement, uint8 **ou
|
|||
}
|
||||
}
|
||||
free(pixels);
|
||||
free(src);
|
||||
free(src_orig);
|
||||
|
||||
int bufferLength = (int)(dst - buffer);
|
||||
buffer = realloc(buffer, bufferLength);
|
||||
|
|
Loading…
Reference in New Issue