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 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
(cherry picked from commit 1307be519b)
This commit is contained in:
Emil Velikov 2015-07-29 15:44:32 +01:00
parent d8116f8ec5
commit b70176d96b

View file

@ -489,7 +489,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);
@ -778,7 +778,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);