fdasd: fix resource leak in fdasd_parse_conffile()

Deallocate the file descriptor.

Found with Cppcheck:
[fdasd/fdasd.c:731]: (error) Resource leak: fd

Cc: Stefan Haberland <sth@linux.ibm.com>
Cc: Jan Hoeppner <hoeppner@linux.ibm.com>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Jens Remus
2017-09-05 21:58:07 +02:00
committed by Jan Höppner
parent 90ea5d9e5d
commit 17cade6e7f

View File

@@ -727,9 +727,9 @@ static int fdasd_parse_conffile(fdasd_anchor_t *anc,
memset(buffer, 0, sizeof(buffer));
rc = read(fd, buffer, sizeof(buffer) - 1);
close(fd);
if (rc < 0)
return -1;
close(fd);
for (i = 0; i < rc; i++)
buffer[i] = toupper(buffer[i]);