st/xa: don't call close(-1) in xa_tracker_create error path
authorEmil Velikov <emil.l.velikov@gmail.com>
Sat, 14 May 2016 15:33:11 +0000 (16:33 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Mon, 23 May 2016 11:07:46 +0000 (12:07 +0100)
Analogous to previous commit.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
src/gallium/state_trackers/xa/xa_tracker.c

index f09baed1d849539a6b5c154e8d69228e2e66b591..e091b0834111bd0053a85952829a7e6a5752f88e 100644 (file)
@@ -152,7 +152,7 @@ xa_tracker_create(int drm_fd)
     struct xa_tracker *xa = calloc(1, sizeof(struct xa_tracker));
     enum xa_surface_type stype;
     unsigned int num_formats;
-    int fd = -1;
+    int fd;
 
     if (!xa)
        return NULL;
@@ -212,9 +212,9 @@ xa_tracker_create(int drm_fd)
  out_no_screen:
     if (xa->dev)
        pipe_loader_release(&xa->dev, 1);
-    fd = -1;
+    else
+       close(fd);
  out_no_fd:
-    close(fd);
     free(xa);
     return NULL;
 }