mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-20 22:34:21 +01:00
take: allocate temporary variables off NULL.
If we're going to simply take() a pointer, don't allocate it off a random object. Using NULL makes our intent clear, particularly with allocating packets we're going to take() onto a queue. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -613,7 +613,7 @@ static bool process_getblockhash_for_txout(struct bitcoin_cli *bcli)
|
||||
|
||||
start_bitcoin_cli(bcli->bitcoind, NULL, process_getblock, false, cb, go,
|
||||
"getblock",
|
||||
take(tal_strndup(go, bcli->output,bcli->output_bytes)),
|
||||
take(tal_strndup(NULL, bcli->output,bcli->output_bytes)),
|
||||
NULL);
|
||||
return true;
|
||||
}
|
||||
@@ -635,7 +635,7 @@ void bitcoind_getoutput_(struct bitcoind *bitcoind,
|
||||
/* We may not have topology ourselves that far back, so ask bitcoind */
|
||||
start_bitcoin_cli(bitcoind, NULL, process_getblockhash_for_txout,
|
||||
true, cb, go,
|
||||
"getblockhash", take(tal_fmt(go, "%u", blocknum)),
|
||||
"getblockhash", take(tal_fmt(NULL, "%u", blocknum)),
|
||||
NULL);
|
||||
|
||||
/* Looks like a leak, but we free it in process_getblock */
|
||||
|
||||
@@ -293,7 +293,7 @@ void channel_fail_permanent(struct channel *channel, const char *fmt, ...)
|
||||
va_end(ap);
|
||||
|
||||
if (channel->scid) {
|
||||
msg = towire_gossip_disable_channel(channel,
|
||||
msg = towire_gossip_disable_channel(NULL,
|
||||
channel->scid,
|
||||
channel->peer->direction,
|
||||
false);
|
||||
@@ -390,7 +390,7 @@ void channel_fail_transient(struct channel *channel, const char *fmt, ...)
|
||||
if (ld->no_reconnect)
|
||||
return;
|
||||
#endif /* DEVELOPER */
|
||||
u8 *msg = towire_gossipctl_reach_peer(channel,
|
||||
u8 *msg = towire_gossipctl_reach_peer(NULL,
|
||||
&channel->peer->id);
|
||||
subd_send_msg(ld->gossip, take(msg));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user