Avoid NULL pointer dereference when new_initial_channel(...) fails

This commit is contained in:
practicalswift 2017-12-08 16:13:03 +01:00 committed by Christian Decker
parent 38fc280fad
commit 307e8c0180

View File

@ -45,10 +45,9 @@ struct channel *new_channel(const tal_t *ctx,
remote_funding_pubkey, remote_funding_pubkey,
funder); funder);
if (channel) {
/* Feerates can be different. */ /* Feerates can be different. */
channel->view[REMOTE].feerate_per_kw = feerate_per_kw[REMOTE]; channel->view[REMOTE].feerate_per_kw = feerate_per_kw[REMOTE];
if (channel) {
channel->htlcs = tal(channel, struct htlc_map); channel->htlcs = tal(channel, struct htlc_map);
htlc_map_init(channel->htlcs); htlc_map_init(channel->htlcs);
tal_add_destructor(channel->htlcs, htlc_map_clear); tal_add_destructor(channel->htlcs, htlc_map_clear);