i965: replace all dup() with os_dupfd_cloexec()
[mesa.git] / src / mesa / drivers / dri / i965 / brw_sync.c
index 639164887913e6956ba1cc1c95188c16354150c1..78b18443be61c858eb243205c1fdc4ffab046264 100644 (file)
@@ -40,7 +40,7 @@
 
 #include <libsync.h> /* Requires Android or libdrm-2.4.72 */
 
-#include "main/imports.h"
+#include "util/os_file.h"
 
 #include "brw_context.h"
 #include "intel_batchbuffer.h"
@@ -354,6 +354,7 @@ brw_gl_delete_sync(struct gl_context *ctx, struct gl_sync_object *_sync)
    struct brw_gl_sync *sync = (struct brw_gl_sync *) _sync;
 
    brw_fence_finish(&sync->fence);
+   free(sync->gl.Label);
    free(sync);
 }
 
@@ -502,7 +503,7 @@ brw_dri_create_fence_fd(__DRIcontext *dri_ctx, int fd)
          goto fail;
    } else {
       /* Import the sync fd as an in-fence. */
-      fence->sync_fd = dup(fd);
+      fence->sync_fd = os_dupfd_cloexec(fd);
    }
 
    assert(fence->sync_fd != -1);
@@ -519,7 +520,7 @@ static int
 brw_dri_get_fence_fd_locked(struct brw_fence *fence)
 {
    assert(fence->type == BRW_FENCE_TYPE_SYNC_FD);
-   return dup(fence->sync_fd);
+   return os_dupfd_cloexec(fence->sync_fd);
 }
 
 static int