From 4030ccf94c03fe171d87ef59e46dc0edb4acb1d3 Mon Sep 17 00:00:00 2001 From: lisa neigut Date: Wed, 4 Sep 2019 12:31:21 -0500 Subject: [PATCH] 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. --- openingd/openingd.c | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/openingd/openingd.c b/openingd/openingd.c index d53910681..42b94b215 100644 --- a/openingd/openingd.c +++ b/openingd/openingd.c @@ -828,30 +828,6 @@ static u8 *funder_channel_complete(struct state *state) * succeed because we checked it earlier */ 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)) return NULL;