Browse Source

Bugfix: free memory allocated for config file loading/writing

Luke Dashjr 11 years ago
parent
commit
549bafcfdc
1 changed files with 2 additions and 0 deletions
  1. 2 0
      miner.c

+ 2 - 0
miner.c

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