Просмотр исходного кода

Fix uninitialised variable 'properties'

If SDL_CreateHashTable() fails, properties->lock is not initialised, SDL_FreeProperties() is called and destroys the uninitialised lock.
Mathieu Eyraud 2 лет назад
Родитель
Сommit
dfb87e1099
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      src/SDL_properties.c

+ 1 - 1
src/SDL_properties.c

@@ -119,7 +119,7 @@ SDL_PropertiesID SDL_CreateProperties(void)
         return 0;
     }
 
-    properties = SDL_malloc(sizeof(*properties));
+    properties = SDL_calloc(1, sizeof(*properties));
     if (!properties) {
         goto error;
     }