Commit 3f6f8a8c authored by zhujun2's avatar zhujun2 Committed by Shuah Khan

selftests/efivarfs: create-read: fix a resource leak

The opened file should be closed in main(), otherwise resource
leak will occur that this problem was discovered by code reading
Signed-off-by: default avatarzhujun2 <zhujun2@cmss.chinamobile.com>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent 11df2885
......@@ -32,8 +32,10 @@ int main(int argc, char **argv)
rc = read(fd, buf, sizeof(buf));
if (rc != 0) {
fprintf(stderr, "Reading a new var should return EOF\n");
close(fd);
return EXIT_FAILURE;
}
close(fd);
return EXIT_SUCCESS;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment