mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
tools: hv: Fix file descriptor leaks
Close "fd" file descriptor when is goes out of scope so it does not leak. Signed-off-by: Tomas Hozza <[email protected]> Acked-by: K. Y. Srinivasan <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
f14e600a3b
commit
fca597558e
1 changed files with 5 additions and 1 deletions
|
|
@ -257,12 +257,15 @@ static int kvp_file_init(void)
|
|||
|
||||
|
||||
filep = fopen(fname, "re");
|
||||
if (!filep)
|
||||
if (!filep) {
|
||||
close(fd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
record = malloc(alloc_unit * num_blocks);
|
||||
if (record == NULL) {
|
||||
fclose(filep);
|
||||
close(fd);
|
||||
return 1;
|
||||
}
|
||||
for (;;) {
|
||||
|
|
@ -286,6 +289,7 @@ static int kvp_file_init(void)
|
|||
num_blocks);
|
||||
if (record == NULL) {
|
||||
fclose(filep);
|
||||
close(fd);
|
||||
return 1;
|
||||
}
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Reference in a new issue