Merge pull request #484 from Minabsapi/master-fix-interface_memory_leak_mitigation

Hotfix: fixed memory leak in binary interface
This commit is contained in:
zeromus 2021-11-03 14:14:45 -04:00 committed by GitHub
commit 83a3d30fa8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -69,6 +69,7 @@ static void resizeWindow_stub(u16 width, u16 height, void *sdl_ogl_screen_textur
static void sdl_draw_no_opengl() static void sdl_draw_no_opengl()
{ {
// TODO Mirror the changes from POSIX CLI's main.cpp `Draw` method, if stable
const NDSDisplayInfo &displayInfo = GPU->GetDisplayInfo(); const NDSDisplayInfo &displayInfo = GPU->GetDisplayInfo();
const size_t pixCount = GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT; const size_t pixCount = GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT;
ColorspaceApplyIntensityToBuffer16<false, false>(displayInfo.nativeBuffer16[NDSDisplayID_Main], pixCount, displayInfo.backlightIntensity[NDSDisplayID_Main]); ColorspaceApplyIntensityToBuffer16<false, false>(displayInfo.nativeBuffer16[NDSDisplayID_Main], pixCount, displayInfo.backlightIntensity[NDSDisplayID_Main]);
@ -79,8 +80,10 @@ static void sdl_draw_no_opengl()
SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer, rawImage); SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer, rawImage);
SDL_FreeSurface(rawImage); SDL_FreeSurface(rawImage);
rawImage = NULL;
SDL_RenderCopy(renderer, texture, NULL, NULL); SDL_RenderCopy(renderer, texture, NULL, NULL);
SDL_RenderPresent(renderer); SDL_RenderPresent(renderer);
SDL_DestroyTexture(texture);
} }
#ifdef INCLUDE_OPENGL_2D #ifdef INCLUDE_OPENGL_2D