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:
Michał Janiszewski 2015-11-12 14:08:32 +01:00
parent b5b1957f58
commit 6723f51087
1 changed files with 2 additions and 1 deletions

View File

@ -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);