Free the string returned by SDL_GetBasePath

Thanks, Fayti1703.
This commit is contained in:
Clownacy 2019-07-29 14:33:14 +00:00
parent 2d73fd8bb9
commit 0b874153d4

View file

@ -94,7 +94,9 @@ int GetFramePerSecound()
int main(int argc, char *argv[])
{
// Get executable's path
strcpy(gModulePath, SDL_GetBasePath());
char *base_path = SDL_GetBasePath();
strcpy(gModulePath, base_path);
SDL_free(base_path);
if (gModulePath[strlen(gModulePath) - 1] == '/' || gModulePath[strlen(gModulePath) - 1] == '\\')
gModulePath[strlen(gModulePath) - 1] = '\0'; // String cannot end in slash or stuff will probably break (original does this through a windows.h provided function)