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

sysjoystick: don't leak fd on error

Wim Taymans 1 год назад
Родитель
Сommit
a44107540d
1 измененных файлов с 1 добавлено и 0 удалено
  1. 1 0
      src/joystick/linux/SDL_sysjoystick.c

+ 1 - 0
src/joystick/linux/SDL_sysjoystick.c

@@ -1518,6 +1518,7 @@ static SDL_sensorlist_item *GetSensor(SDL_joylist_item *item)
         return NULL;
     }
     if (ioctl(fd_item, EVIOCGUNIQ(sizeof(uniq_item) - 1), &uniq_item) < 0) {
+        close(fd_item);
         return NULL;
     }
     close(fd_item);