[Mesa-dev] [PATCH] loader: fds can be 0

Dave Airlie airlied at gmail.com
Mon Sep 1 02:45:26 PDT 2014


Possible resource leak reported by coverity.

Reported-by: Coverity scanner.
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/loader/loader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/loader/loader.c b/src/loader/loader.c
index 47e1f58..bdd3906 100644
--- a/src/loader/loader.c
+++ b/src/loader/loader.c
@@ -402,7 +402,7 @@ int loader_get_user_preferred_fd(int default_fd, int *different_device)
    }
 
    fd = drm_open_device(device_name);
-   if (fd > 0) {
+   if (fd >= 0) {
       close(default_fd);
    } else {
       fd = default_fd;
-- 
1.9.3



More information about the mesa-dev mailing list