Browse Source

Bugfix: modminer: Avoid leaking devname when detecting claimed devices

Luke Dashjr 11 years ago
parent
commit
9575a952d3
1 changed files with 2 additions and 2 deletions
  1. 2 2
      driver-modminer.c

+ 2 - 2
driver-modminer.c

@@ -132,8 +132,7 @@ modminer_detect_one(const char *devpath)
 	buf[len] = '\0';
 	if (strncasecmp(buf, "ModMiner", 8))
 		bailout(LOG_DEBUG, "%s: %s: response did not begin with 'ModMiner'", __func__, devpath);
-	char*devname = strdup(buf);
-	applog(LOG_DEBUG, "ModMiner identified as: %s", devname);
+	applog(LOG_DEBUG, "ModMiner identified as: %s", buf);
 
 	if (serial_claim_v(devpath, &modminer_drv))
 	{
@@ -141,6 +140,7 @@ modminer_detect_one(const char *devpath)
 		return false;
 	}
 	
+	char*devname = strdup(buf);
 	if (1 != write(fd, MODMINER_FPGA_COUNT, 1))
 		bailout(LOG_DEBUG, "ModMiner detect: write failed on %s (get FPGA count)", devpath);
 	len = read(fd, buf, 1);