mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-17 19:03:42 +01:00
fix memleak: remove duplicated new_channel creation
We call this same exact code inside `funder_finalize_channel_setup`; which results in a memleak since we don't free the previous before clobbering it.
This commit is contained in:
parent
4d2f91f7ae
commit
4030ccf94c
@ -828,30 +828,6 @@ static u8 *funder_channel_complete(struct state *state)
|
|||||||
* succeed because we checked it earlier */
|
* succeed because we checked it earlier */
|
||||||
assert(amount_sat_sub_msat(&local_msat, state->funding, state->push_msat));
|
assert(amount_sat_sub_msat(&local_msat, state->funding, state->push_msat));
|
||||||
|
|
||||||
state->channel = new_initial_channel(state,
|
|
||||||
&state->chainparams->genesis_blockhash,
|
|
||||||
&state->funding_txid,
|
|
||||||
state->funding_txout,
|
|
||||||
state->minimum_depth,
|
|
||||||
state->funding,
|
|
||||||
local_msat,
|
|
||||||
state->feerate_per_kw,
|
|
||||||
&state->localconf,
|
|
||||||
&state->remoteconf,
|
|
||||||
&state->our_points,
|
|
||||||
&state->their_points,
|
|
||||||
&state->our_funding_pubkey,
|
|
||||||
&state->their_funding_pubkey,
|
|
||||||
/* Funder is local */
|
|
||||||
LOCAL);
|
|
||||||
/* We were supposed to do enough checks above, but just in case,
|
|
||||||
* new_initial_channel will fail to create absurd channels */
|
|
||||||
if (!state->channel)
|
|
||||||
peer_failed(state->pps,
|
|
||||||
&state->channel_id,
|
|
||||||
"could not create channel with given config");
|
|
||||||
|
|
||||||
|
|
||||||
if (!funder_finalize_channel_setup(state, local_msat, &sig, &tx))
|
if (!funder_finalize_channel_setup(state, local_msat, &sig, &tx))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user