summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Nykryn <lnykryn@redhat.com>2012-09-21 13:03:00 +0200
committerKay Sievers <kay@vrfy.org>2012-09-23 14:24:44 +0200
commit9c513fe009968151fe95961dd9d5088c609aed98 (patch)
treea8799bda6196d0e63ef364aa0d0682d12276bf82
parentab261e1226efac3d47b2dc4a0e0165aeb8bb528e (diff)
udev: free fd before return in accelerometer.c
-rw-r--r--src/udev/accelerometer/accelerometer.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/udev/accelerometer/accelerometer.c b/src/udev/accelerometer/accelerometer.c
index b8ed7b8edd..67fed27c5e 100644
--- a/src/udev/accelerometer/accelerometer.c
+++ b/src/udev/accelerometer/accelerometer.c
@@ -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) {