From 6d20c646d600518a67f6fb93ea0c71d03e65d74a Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst Date: Sun, 24 Mar 2013 14:37:41 +0100 Subject: [PATCH] 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 --- src/gallium/drivers/nvc0/nvc0_video.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/nvc0/nvc0_video.c b/src/gallium/drivers/nvc0/nvc0_video.c index cdb80dba064..b185ded09f0 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; } -- 2.30.2