aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Clark2016-06-01 13:35:06 -0500
committerRob Clark2016-07-20 18:42:21 -0500
commitfe07584e050db55d0e41ed52c0c42f5e8ae84315 (patch)
tree61a25296b8a84fd6df196e358a2cbfafe8ee91f2 /freedreno
parenteb846d46bca614f24c50f3fa89f94a6820e16589 (diff)
downloadexternal-libdrm-fe07584e050db55d0e41ed52c0c42f5e8ae84315.tar.gz
external-libdrm-fe07584e050db55d0e41ed52c0c42f5e8ae84315.tar.xz
external-libdrm-fe07584e050db55d0e41ed52c0c42f5e8ae84315.zip
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:
95 */ 95 */
96struct fd_device * fd_device_new_dup(int fd) 96struct fd_device * fd_device_new_dup(int fd)
97{ 97{
98 struct fd_device *dev = fd_device_new(dup(fd)); 98 int dup_fd = dup(fd);
99 struct fd_device *dev = fd_device_new(dup_fd);
99 if (dev) 100 if (dev)
100 dev->closefd = 1; 101 dev->closefd = 1;
102 else
103 close(dup_fd);
101 return dev; 104 return dev;
102} 105}
103 106