Browse Source

close file descriptor if ioctls failed

hondres 9 years ago
parent
commit
2809b31f8c
1 changed files with 1 additions and 0 deletions
  1. 1 0
      platform/x11/joystick_linux.cpp

+ 1 - 0
platform/x11/joystick_linux.cpp

@@ -304,6 +304,7 @@ void joystick_linux::open_joystick(const char *p_path) {
 		if ((ioctl(fd, EVIOCGBIT(0, sizeof(evbit)), evbit) < 0) ||
 		    (ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(keybit)), keybit) < 0) ||
 		    (ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(absbit)), absbit) < 0)) {
+			close(fd);
 			return;
 		}