tools/csr_usb: Fix resource leak 46/31546/1
authorGowtham Anandha Babu <gowtham.ab@samsung.com>
Fri, 5 Dec 2014 13:56:28 +0000 (19:26 +0530)
committerGowtham Anandha Babu <gowtham.ab@samsung.com>
Fri, 5 Dec 2014 13:56:28 +0000 (19:26 +0530)
File opened with fopen() should be
closed by fclose().

Change-Id: I35b96e4087c0a51c6027bd6236543915039d7ebb

tools/csr_usb.c

index 5fb6bdc..a1d7324 100644 (file)
@@ -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;
 }