Fix memory leak in ConnectSensor

'name' is leaked in case of error.
This commit is contained in:
Mathieu Eyraud authored and Sam Lantinga committed 2021-02-21 16:46:20 -08:00
1 parent 557aa140e8
commit 844d5e3ed3
1 file changed
+1
+1
View File
@@ -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();
}