mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-26 06:25:33 +00:00
Windows SDL_GetBasePath: free string on failure.
This commit is contained in:
parent
aa43bee434
commit
4d1626d042
|
@ -58,14 +58,15 @@ SDL_GetBasePath(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
while (SDL_TRUE) {
|
while (SDL_TRUE) {
|
||||||
WCHAR *ptr = (WCHAR *)SDL_realloc(path, buflen * sizeof (WCHAR));
|
void *ptr = SDL_realloc(path, buflen * sizeof (WCHAR));
|
||||||
if (!ptr) {
|
if (!ptr) {
|
||||||
SDL_free(path);
|
SDL_free(path);
|
||||||
FreeLibrary(psapi);
|
FreeLibrary(psapi);
|
||||||
SDL_OutOfMemory();
|
SDL_OutOfMemory();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
path = ptr;
|
|
||||||
|
path = (WCHAR *) ptr;
|
||||||
|
|
||||||
len = pGetModuleFileNameExW(GetCurrentProcess(), NULL, path, buflen);
|
len = pGetModuleFileNameExW(GetCurrentProcess(), NULL, path, buflen);
|
||||||
if (len != buflen) {
|
if (len != buflen) {
|
||||||
|
@ -79,6 +80,7 @@ SDL_GetBasePath(void)
|
||||||
FreeLibrary(psapi);
|
FreeLibrary(psapi);
|
||||||
|
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
|
SDL_free(path);
|
||||||
WIN_SetError("Couldn't locate our .exe");
|
WIN_SetError("Couldn't locate our .exe");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue