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>
This commit is contained in:
Christian Marangi
2023-05-29 19:25:32 +02:00
parent 7d2b17c91b
commit e218150979

View File

@@ -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;