mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
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:
@@ -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]);
|
||||
|
||||
Reference in New Issue
Block a user