From d7b7e9c410e40235f427ad30b8e9bfbbb86ed273 Mon Sep 17 00:00:00 2001 From: Gowtham Anandha Babu Date: Fri, 5 Dec 2014 19:26:28 +0530 Subject: [PATCH] tools/csr_usb: Fix resource leak File opened with fopen() should be closed by fclose(). Change-Id: I35b96e4087c0a51c6027bd6236543915039d7ebb --- tools/csr_usb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/csr_usb.c b/tools/csr_usb.c index 5fb6bdc..a1d7324 100644 --- a/tools/csr_usb.c +++ b/tools/csr_usb.c @@ -80,9 +80,12 @@ static int read_value(const char *name, const char *attr, const char *format) return -1; n = fscanf(file, format, &value); - if (n != 1) + if (n != 1) { + fclose(file); return -1; + } + fclose(file); return value; } -- 2.7.4