summaryrefslogtreecommitdiff
path: root/freedreno
diff options
context:
space:
mode:
authorRob Clark <robclark@freedesktop.org>2016-06-01 14:35:06 -0400
committerRob Clark <robclark@freedesktop.org>2016-07-20 19:42:21 -0400
commitfe07584e050db55d0e41ed52c0c42f5e8ae84315 (patch)
tree61a25296b8a84fd6df196e358a2cbfafe8ee91f2 /freedreno
parenteb846d46bca614f24c50f3fa89f94a6820e16589 (diff)
freedreno: fix potential fd leak in error path
Signed-off-by: Rob Clark <robclark@freedesktop.org>
Diffstat (limited to 'freedreno')
-rw-r--r--freedreno/freedreno_device.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/freedreno/freedreno_device.c b/freedreno/freedreno_device.c
index 027414ec..3da5c7c1 100644
--- a/freedreno/freedreno_device.c
+++ b/freedreno/freedreno_device.c
@@ -95,9 +95,12 @@ out:
*/
struct fd_device * fd_device_new_dup(int fd)
{
- struct fd_device *dev = fd_device_new(dup(fd));
+ int dup_fd = dup(fd);
+ struct fd_device *dev = fd_device_new(dup_fd);
if (dev)
dev->closefd = 1;
+ else
+ close(dup_fd);
return dev;
}