@@ -656,17 +656,12 @@ static void display_draw_suspend_overlay_internal(void) {
656656 true);
657657 if (suspend_text == NULL ) {
658658 LOG_ERR ("Failed to load suspend overlay texture: %s" , SDL_GetError ());
659- SDL_DestroyTexture (overlay );
660- SDL_SetRenderTarget (drv -> renderer , NULL );
661- return ;
659+ goto cleanup ;
662660 }
663661 float text_width = 0.0f , text_height = 0.0f ;
664662 if (!SDL_GetTextureSize (suspend_text , & text_width , & text_height )) {
665663 LOG_ERR ("SDL_GetTextureSize failed: %s" , SDL_GetError ());
666- SDL_DestroyTexture (suspend_text );
667- SDL_DestroyTexture (overlay );
668- SDL_SetRenderTarget (drv -> renderer , NULL );
669- return ;
664+ goto cleanup ;
670665 }
671666 SDL_FRect middle = {(screen .w - text_width ) / 2 , (screen .h - text_height ) / 2 ,
672667 text_width , text_height };
@@ -678,9 +673,10 @@ static void display_draw_suspend_overlay_internal(void) {
678673 SDL_RenderTexture (drv -> renderer , overlay , NULL , & screen );
679674 SDL_RenderPresent (drv -> renderer );
680675
681- // cleanup
676+ cleanup :
682677 SDL_DestroyTexture (suspend_text );
683678 SDL_DestroyTexture (overlay );
679+ SDL_SetRenderTarget (drv -> renderer , NULL );
684680 SDL_SetRenderDrawColor (drv -> renderer , 0 , 0 , 0 , 255 );
685681}
686682
0 commit comments