Sfoglia il codice sorgente

sysjoystick: don't leak fd on error

Wim Taymans 1 anno fa
parent
commit
a44107540d
1 ha cambiato i file con 1 aggiunte e 0 eliminazioni
  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);