Module: Mesa
Branch: master
Commit: 6d20c646d600518a67f6fb93ea0c71d03e65d74a
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6d20c646d600518a67f6fb93ea0c71d03e65d74a

Author: Maarten Lankhorst <[email protected]>
Date:   Sun Mar 24 14:37:41 2013 +0100

nvc0: Fix fd leak in nvc0_create_decoder

NOTE: This is a candidate for the 9.0 and 9.1 branches.

Signed-off-by: Maarten Lankhorst <[email protected]>

---

 src/gallium/drivers/nvc0/nvc0_video.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nvc0/nvc0_video.c 
b/src/gallium/drivers/nvc0/nvc0_video.c
index cdb80db..b185ded 100644
--- a/src/gallium/drivers/nvc0/nvc0_video.c
+++ b/src/gallium/drivers/nvc0/nvc0_video.c
@@ -356,19 +356,19 @@ nvc0_create_decoder(struct pipe_context *context,
          goto fw_fail;
       }
       r = read(fd, dec->fw_bo->map, 0x4000);
+      close(fd);
+
       if (r < 0) {
          fprintf(stderr, "reading firmware file %s failed: %m\n", path);
          goto fw_fail;
       }
 
       if (r == 0x4000) {
-         close(fd);
          fprintf(stderr, "firmware file %s too large!\n", path);
          goto fw_fail;
       }
 
       if (r & 0xff) {
-         close(fd);
          fprintf(stderr, "firmware file %s wrong size!\n", path);
          goto fw_fail;
       }

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to