소스 검색

testsprite: zero initialize textures

LoadSprite destroys current textures before allocating new ones.
So make sure the previous (=first) textures are valid.
Anonymous Maarten 21 시간 전
부모
커밋
7501f7194b
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      test/testsprite.c

+ 1 - 1
test/testsprite.c

@@ -502,7 +502,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
 
     /* Create the windows, initialize the renderers, and load the textures */
     sprites =
-        (SDL_Texture **)SDL_malloc(state->num_windows * sizeof(*sprites));
+        (SDL_Texture **)SDL_calloc(state->num_windows, sizeof(*sprites));
     if (!sprites) {
         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!");
         return SDL_APP_FAILURE;