shithub: cstory

Download patch

ref: 0b874153d49216f6b8b27809a8d3cf085055df5f
parent: 2d73fd8bb913500551dad70de8ad9d2cd45aaf63
author: Clownacy <Clownacy@users.noreply.github.com>
date: Mon Jul 29 10:33:14 EDT 2019

Free the string returned by SDL_GetBasePath

Thanks, Fayti1703.

--- a/src/Main.cpp
+++ b/src/Main.cpp
@@ -94,7 +94,9 @@
 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)