Commits

Anonymous committed 6d6a314

udev: free fd before return in accelerometer.c

Comments (0)

Files changed (1)

src/accelerometer/accelerometer.c

 
                 r = read(fd, ev, sizeof(struct input_event) * 64);
 
-                if (r < (int) sizeof(struct input_event))
+                if (r < (int) sizeof(struct input_event)) {
+                        close(fd);
                         return;
+                }
 
                 for (i = 0; i < r / (int) sizeof(struct input_event); i++) {
                         if (got_syn == 1) {