diff options
author | Rob Clark <robclark@freedesktop.org> | 2016-06-01 14:35:06 -0400 |
---|---|---|
committer | Rob Clark <robclark@freedesktop.org> | 2016-07-20 19:42:21 -0400 |
commit | fe07584e050db55d0e41ed52c0c42f5e8ae84315 (patch) | |
tree | 61a25296b8a84fd6df196e358a2cbfafe8ee91f2 /freedreno | |
parent | eb846d46bca614f24c50f3fa89f94a6820e16589 (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.c | 5 |
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; } |