dualopend: plug memleak.

1. fromwire now allocates TLVs, so this was actually a leak.
2. We can simply hand "NULL" to towire_, since that is the same as
   this empty tlv.

```
...89221a0054c11c1e3ca31d59-dualopend-chan#1: MEMLEAK: 0x56148649c458
...89221a0054c11c1e3ca31d59-dualopend-chan#1:   label=wire/peer_exp_wiregen.c:1041:struct tlv_channel_reestablish_tlvs
...89221a0054c11c1e3ca31d59-dualopend-chan#1:   backtrace:
...89221a0054c11c1e3ca31d59-dualopend-chan#1:     /home/rusty/devel/cvs/lightning/ccan/ccan/tal/tal.c:442 (tal_alloc_)
...89221a0054c11c1e3ca31d59-dualopend-chan#1:     /home/rusty/devel/cvs/lightning/wire/peer_exp_wiregen.c:1041 (tlv_channel_reestablish_tlvs_new)
...89221a0054c11c1e3ca31d59-dualopend-chan#1:     /home/rusty/devel/cvs/lightning/openingd/dualopend.c:3536 (do_reconnect_dance)
...89221a0054c11c1e3ca31d59-dualopend-chan#1:     /home/rusty/devel/cvs/lightning/openingd/dualopend.c:3955 (main)
...89221a0054c11c1e3ca31d59-dualopend-chan#1:     ../sysdeps/nptl/libc_start_call_main.h:58 (__libc_start_call_main)
...89221a0054c11c1e3ca31d59-dualopend-chan#1:     ../csu/libc-start.c:392 (__libc_start_main_impl)
...89221a0054c11c1e3ca31d59-dualopend-chan#1:   parents:
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2022-07-21 14:28:08 +09:30 committed by neil saitug
parent 08bef48d5c
commit 8d9c181e3b
1 changed files with 2 additions and 2 deletions

View File

@ -3533,7 +3533,7 @@ static void do_reconnect_dance(struct state *state)
struct pubkey remote_current_per_commit_point;
struct tx_state *tx_state = state->tx_state;
#if EXPERIMENTAL_FEATURES
struct tlv_channel_reestablish_tlvs *tlvs = tlv_channel_reestablish_tlvs_new(NULL);
struct tlv_channel_reestablish_tlvs *tlvs;
#endif
/* BOLT #2:
@ -3550,7 +3550,7 @@ static void do_reconnect_dance(struct state *state)
&last_remote_per_commit_secret,
&state->first_per_commitment_point[LOCAL]
#if EXPERIMENTAL_FEATURES
, tlvs
, NULL
#endif
);
peer_write(state->pps, take(msg));