Commit 10c09c4c8b276c1211f71621c66e8311ca81c0fe

Con Kolivas 2013-11-11T17:47:59

Clean up properly if hfa_detect_common fails in the hashfast driver.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
diff --git a/driver-hashfast.c b/driver-hashfast.c
index 281d2ea..ae23fe1 100644
--- a/driver-hashfast.c
+++ b/driver-hashfast.c
@@ -431,7 +431,12 @@ static bool hfa_detect_one_usb(libusb_device *dev, struct usb_find_devices *foun
 
 	add_cgpu(hashfast);
 
-	return hfa_detect_common(hashfast);
+	if (!hfa_detect_common(hashfast)) {
+		usb_uninit(hashfast);
+		hashfast = usb_free_cgpu(hashfast);
+		return false;
+	}
+	return true;
 }
 
 static void hfa_detect(bool hotplug)