Browse Source

Fix memory leak in ConnectSensor

'name' is leaked in case of error.
Mathieu Eyraud 4 years ago
parent
commit
844d5e3ed3
1 changed files with 1 additions and 0 deletions
  1. 1 0
      src/sensor/windows/SDL_windowssensor.c

+ 1 - 0
src/sensor/windows/SDL_windowssensor.c

@@ -294,6 +294,7 @@ static int ConnectSensor(ISensor *sensor)
     new_sensors = (SDL_Windows_Sensor *)SDL_realloc(SDL_sensors, (SDL_num_sensors + 1) * sizeof(SDL_Windows_Sensor));
     if (new_sensors == NULL) {
         SDL_UnlockSensors();
+        SDL_free(name);
         return SDL_OutOfMemory();
     }