From 844d5e3ed390c5fcf7022fdc1d33d3f38cdaf471 Mon Sep 17 00:00:00 2001 From: Mathieu Eyraud <70028899+meyraud705@users.noreply.github.com> Date: Sun, 21 Feb 2021 11:54:50 +0100 Subject: [PATCH] Fix memory leak in ConnectSensor 'name' is leaked in case of error. --- src/sensor/windows/SDL_windowssensor.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sensor/windows/SDL_windowssensor.c b/src/sensor/windows/SDL_windowssensor.c index 140a8fe1f..d1a449844 100644 --- a/src/sensor/windows/SDL_windowssensor.c +++ b/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(); }