chiark / gitweb /
udev: free fd before return in accelerometer.c
authorLukas Nykryn <lnykryn@redhat.com>
Fri, 21 Sep 2012 11:03:00 +0000 (13:03 +0200)
committerKay Sievers <kay@vrfy.org>
Sun, 23 Sep 2012 12:24:44 +0000 (14:24 +0200)
src/udev/accelerometer/accelerometer.c

index b8ed7b8..67fed27 100644 (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) {