summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2015-07-29 15:44:32 +0100
committerEmil Velikov <[email protected]>2015-08-01 15:44:17 +0100
commit1307be519b8785249ee863a22115930299ff642a (patch)
tree15ef28d906b75870537afd671da3409e55ee4cc0 /src/gallium/winsys
parenteb3e2562a4bf728082818b46dcae1ab88340786e (diff)
winsys/radeon: don't leak the fd when it is 0
Earlier commit added an extra dup(fd) to fix a ZaphodHeads issue. Although it did not consider the (very unlikely) case where we might end up with the valid fd == 0. Fixes: 28dda47ae4d(winsys/radeon: Use dup fd as key in drm-winsys hash table to fix ZaphodHeads.) Cc: 10.6 <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Reviewed-by: Mario Kleiner <[email protected]>
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_winsys.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
index 41f8826c39d..f7784fb795e 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
@@ -493,7 +493,7 @@ static void radeon_winsys_destroy(struct radeon_winsys *rws)
radeon_surface_manager_free(ws->surf_man);
}
- if (ws->fd)
+ if (ws->fd >= 0)
close(ws->fd);
FREE(rws);
@@ -786,7 +786,7 @@ fail:
ws->kman->destroy(ws->kman);
if (ws->surf_man)
radeon_surface_manager_free(ws->surf_man);
- if (ws->fd)
+ if (ws->fd >= 0)
close(ws->fd);
FREE(ws);