summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOlivier Blin <olivier.blin@softathome.com>2014-09-09 17:03:57 +0200
committerRobin Burchell <robin.burchell@viroteck.net>2014-10-21 18:42:27 +0200
commit9f09b33d05249e9121092953ffcd2a2c82b9eeef (patch)
tree6d91e2bb3e3188d576b5746a350d396a9dbf7a9e /src
parent3014d58a660ea976a9d2fb1561ade345be6959d8 (diff)
Fix fd leak in case of ftruncate() failure in qwlkeyboard
Change-Id: Id7d6582d4e139763634c7022548b558d4a2f8ec2 Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com> Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Diffstat (limited to 'src')
-rw-r--r--src/compositor/wayland_wrapper/qwlkeyboard.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/compositor/wayland_wrapper/qwlkeyboard.cpp b/src/compositor/wayland_wrapper/qwlkeyboard.cpp
index 67ad3b727..881f13bc3 100644
--- a/src/compositor/wayland_wrapper/qwlkeyboard.cpp
+++ b/src/compositor/wayland_wrapper/qwlkeyboard.cpp
@@ -303,8 +303,10 @@ static int createAnonymousFile(size_t size)
if (fd < 0)
return -1;
- if (ftruncate(fd, size) < 0)
+ if (ftruncate(fd, size) < 0) {
+ close(fd);
return -1;
+ }
return fd;
}