Browse Source

Bugfix: hashbuster2: Close device and free memory allocated, when no chips are found

Luke Dashjr 12 years ago
parent
commit
91c30fcc03
1 changed files with 7 additions and 0 deletions
  1. 7 0
      driver-hashbuster2.c

+ 7 - 0
driver-hashbuster2.c

@@ -199,7 +199,14 @@ bool hashbuster2_lowl_probe(const struct lowlevel_device_info * const info)
 	
 	chip_n = libbitfury_detectChips1(port);
 	if (unlikely(!chip_n))
+	{
+		applog(LOG_WARNING, "%s: No chips found on %s", __func__, serial);
+		free(port);
+		free(serial);
+		libusb_release_interface(h, 0);
+		libusb_close(h);
 		return false;
+	}
 	
 	{
 		devicelist = malloc(sizeof(*devicelist) * chip_n);