udev: free fd before return in accelerometer.c

This commit is contained in:
Lukas Nykryn 2012-09-21 13:03:00 +02:00 committed by Kay Sievers
parent ab261e1226
commit 9c513fe009
1 changed files with 3 additions and 1 deletions

View File

@ -205,8 +205,10 @@ static void test_orientation(struct udev *udev,
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) {