]> www.infradead.org Git - users/mchehab/rasdaemon.git/commitdiff
rasdaemon: fix missing fclose in ras-events.c:select_tracing_timestamp()
authorShiju Jose <shiju.jose@huawei.com>
Wed, 16 Oct 2019 16:33:57 +0000 (17:33 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Wed, 20 Nov 2019 04:16:24 +0000 (05:16 +0100)
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>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
ras-events.c

index d5432512f43f120c6d1c0a956e46d4e5565f38dd..fc6b2886bac7be9ccdf7a9b8312457062ec729e7 100644 (file)
@@ -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;