diff options
author | Olivier Blin <olivier.blin@softathome.com> | 2014-09-09 17:03:57 +0200 |
---|---|---|
committer | Robin Burchell <robin.burchell@viroteck.net> | 2014-10-21 18:42:27 +0200 |
commit | 9f09b33d05249e9121092953ffcd2a2c82b9eeef (patch) | |
tree | 6d91e2bb3e3188d576b5746a350d396a9dbf7a9e | |
parent | 3014d58a660ea976a9d2fb1561ade345be6959d8 (diff) | |
download | qtwayland-9f09b33d05249e9121092953ffcd2a2c82b9eeef.tar.gz |
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>
-rw-r--r-- | src/compositor/wayland_wrapper/qwlkeyboard.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/compositor/wayland_wrapper/qwlkeyboard.cpp b/src/compositor/wayland_wrapper/qwlkeyboard.cpp index 67ad3b72..881f13bc 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; } |