mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-16 11:06:49 +01:00
Fixed bug 4837 - Use after free in SDL_SensorUpdate (Thanks!)
This commit is contained in:
parent
5025109f29
commit
3ac67cf458
@ -503,7 +503,7 @@ void
|
|||||||
SDL_SensorUpdate(void)
|
SDL_SensorUpdate(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
SDL_Sensor *sensor;
|
SDL_Sensor *sensor, *next;
|
||||||
|
|
||||||
if (!SDL_WasInit(SDL_INIT_SENSOR)) {
|
if (!SDL_WasInit(SDL_INIT_SENSOR)) {
|
||||||
return;
|
return;
|
||||||
@ -531,7 +531,8 @@ SDL_SensorUpdate(void)
|
|||||||
SDL_updating_sensor = SDL_FALSE;
|
SDL_updating_sensor = SDL_FALSE;
|
||||||
|
|
||||||
/* If any sensors were closed while updating, free them here */
|
/* If any sensors were closed while updating, free them here */
|
||||||
for (sensor = SDL_sensors; sensor; sensor = sensor->next) {
|
for (sensor = SDL_sensors; sensor; sensor = next) {
|
||||||
|
next = sensor->next;
|
||||||
if (sensor->ref_count <= 0) {
|
if (sensor->ref_count <= 0) {
|
||||||
SDL_SensorClose(sensor);
|
SDL_SensorClose(sensor);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user