From: Christian Marangi Date: Mon, 29 May 2023 17:25:32 +0000 (+0200) Subject: remote: close file on usteer_init_local_id fread fail X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;p=project%2Fusteer.git 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 --- 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;