Skip to contentSkip to conversation

tools/csr_usb : Fix Resource leak: file

PATCH In review gowtham babu 1 participant 1 message Sep 5, 2014 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 tools/csr_usb : Fix Resource leak: file

Handles resource leak.

In the previous mail, I wrongly entered the PATCH subject prefix as [MAP]. This is the updated one. Sorry for the inconvenience caused if any.

---
 tools/csr_usb.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tools/csr_usb.c +4 -1
index 5fb6bdc..a1d7324 100644
@@ -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;
 }
 
Signature · 1 line
1.9.1