diff mbox series

[3/7] rasdaemon: fix missing fclose in ras-events.c:select_tracing_timestamp()

Message ID 20191016163401.16980-4-shiju.jose@huawei.com (mailing list archive)
State Accepted
Headers show
Series rasdaemon: add fixes, database closure and signal handling | expand

Commit Message

Shiju Jose Oct. 16, 2019, 4:33 p.m. UTC
This patch adds fix for missing fclose() in select_tracing_timestamp()
when return fail if can't parse /proc/uptime.

Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
---
 ras-events.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/ras-events.c b/ras-events.c
index d543251..fc6b288 100644
--- a/ras-events.c
+++ b/ras-events.c
@@ -600,12 +600,12 @@  static int select_tracing_timestamp(struct ras_events *ras)
 		return 0;
 	}
 	rc = fscanf(fp, "%zu.%u ", &uptime, &j1);
+	fclose(fp);
 	if (rc <= 0) {
 		log(TERM, LOG_ERR, "Can't parse /proc/uptime!\n");
 		return -1;
 	}
 	now = time(NULL);
-	fclose(fp);
 
 	ras->use_uptime = 1;
 	ras->uptime_diff = now - uptime;