Browse Source

Bugfix: Keep JSON from getaccountaddress around long enough for debug messages

Luke Dashjr 10 years ago
parent
commit
8991452d9b
1 changed files with 3 additions and 1 deletions
  1. 3 1
      miner.c

+ 3 - 1
miner.c

@@ -2920,20 +2920,22 @@ void refresh_bitcoind_address(const bool fresh)
 			continue;
 			continue;
 		}
 		}
 		s2 = set_b58addr(s, &newscript);
 		s2 = set_b58addr(s, &newscript);
-		json_decref(json);
 		if (unlikely(s2))
 		if (unlikely(s2))
 		{
 		{
 			applog(LOG_WARNING, "Error %cetting coinbase address from pool %d: %s", 's', pool->pool_no, s2);
 			applog(LOG_WARNING, "Error %cetting coinbase address from pool %d: %s", 's', pool->pool_no, s2);
+			json_decref(json);
 			continue;
 			continue;
 		}
 		}
 		if (bytes_eq(&newscript, &opt_coinbase_script))
 		if (bytes_eq(&newscript, &opt_coinbase_script))
 		{
 		{
 			applog(LOG_DEBUG, "Pool %d returned coinbase address already in use (%s)", pool->pool_no, s);
 			applog(LOG_DEBUG, "Pool %d returned coinbase address already in use (%s)", pool->pool_no, s);
+			json_decref(json);
 			break;
 			break;
 		}
 		}
 		bytes_assimilate(&opt_coinbase_script, &newscript);
 		bytes_assimilate(&opt_coinbase_script, &newscript);
 		coinbase_script_block_id = current_block_id;
 		coinbase_script_block_id = current_block_id;
 		applog(LOG_NOTICE, "Now using coinbase address %s, provided by pool %d", s, pool->pool_no);
 		applog(LOG_NOTICE, "Now using coinbase address %s, provided by pool %d", s, pool->pool_no);
+		json_decref(json);
 		break;
 		break;
 	}
 	}