Browse Source

Merge commit '9575a95' into bfgminer-4.7.x

Luke Dashjr 11 years ago
parent
commit
8430fecc42
2 changed files with 4 additions and 2 deletions
  1. 2 2
      driver-modminer.c
  2. 2 0
      miner.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);

+ 2 - 0
miner.c

@@ -2516,6 +2516,7 @@ static char *parse_config(json_t *config, bool fileconf, int * const fileconf_lo
 				} else {
 					snprintf(err_buf, sizeof(err_buf), "Parsing JSON option %s: %s",
 						p, err);
+					free(name);
 					return err_buf;
 				}
 			}
@@ -7016,6 +7017,7 @@ void write_config(FILE *fcfg)
 			   0 <= *(int *)opt->u.arg)
 				fprintf(fcfg, ",\n\"%s\" : \"%d\"", p+2, *(int *)opt->u.arg);
 		}
+		free(name);
 	}
 
 	/* Special case options */