summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Marangi2023-05-29 17:25:32 +0000
committerChristian Marangi2023-05-29 17:27:02 +0000
commite218150979b40a1b3c59ad0aaa3bbb943814db1e (patch)
treed5177835b03270627042e6610cc379727ccb0d17
parent7d2b17c91baf67419c0ce63dc6c65a7659ab6a5c (diff)
downloadusteer-e218150979b40a1b3c59ad0aaa3bbb943814db1e.tar.gz
remote: close file on usteer_init_local_id fread fail
Fix Coverity Scan CID 1521041 reporting a not closed FILE on fread fail. Correctly close the FILE on fread fail to fix this leak. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
-rw-r--r--remote.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/remote.c b/remote.c
index 9b753e6..bf58ea3 100644
--- a/remote.c
+++ b/remote.c
@@ -678,8 +678,10 @@ usteer_init_local_id(void)
return -1;
}
- if (fread(&local_id, sizeof(local_id), 1, f) < 1)
+ if (fread(&local_id, sizeof(local_id), 1, f) < 1) {
+ fclose(f);
return -1;
+ }
fclose(f);
return 0;