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 <maarten.lankhorst@canonical.com>
(cherry picked from commit 6d20c646d6)
This commit is contained in:
Maarten Lankhorst 2013-03-24 14:37:41 +01:00 committed by Ian Romanick
parent 46ac963a23
commit 09f5ee9918

View file

@ -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;
}