mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-18 22:54:25 +01:00
lightningd: fix valgrind reported leak when we exit early.
```
E Global errors:
E - Node /tmp/ltests-adkwu44c/test_logging_1/lightning-2/ has memory leaks: [
E {
E "backtrace": [
E "ccan/ccan/tal/tal.c:442 (tal_alloc_)",
E "lightningd/peer_control.c:2203 (load_channels_from_wallet)",
E "lightningd/lightningd.c:1105 (main)"
E ],
E "label": "lightningd/peer_control.c:2203:struct htlc_in_map",
E "parents": [
E "lightningd/lightningd.c:107:struct lightningd"
E ],
E "value": "0x55d920a345e8"
E }
E ]
```
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -1117,8 +1117,11 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
/*~ Now that the rpc path exists, we can start the plugins and they
|
/*~ Now that the rpc path exists, we can start the plugins and they
|
||||||
* can start talking to us. */
|
* can start talking to us. */
|
||||||
if (!plugins_config(ld->plugins))
|
if (!plugins_config(ld->plugins)) {
|
||||||
|
/* Valgrind can complain about this leak! */
|
||||||
|
tal_free(unconnected_htlcs_in);
|
||||||
goto stop;
|
goto stop;
|
||||||
|
}
|
||||||
|
|
||||||
/*~ Process any HTLCs we were in the middle of when we exited, now
|
/*~ Process any HTLCs we were in the middle of when we exited, now
|
||||||
* that plugins (who might want to know via htlc_accepted hook) are
|
* that plugins (who might want to know via htlc_accepted hook) are
|
||||||
|
|||||||
@@ -2797,7 +2797,7 @@ void fixup_htlcs_out(struct lightningd *ld)
|
|||||||
#endif /* COMPAT_V061 */
|
#endif /* COMPAT_V061 */
|
||||||
|
|
||||||
void htlcs_resubmit(struct lightningd *ld,
|
void htlcs_resubmit(struct lightningd *ld,
|
||||||
struct htlc_in_map *unconnected_htlcs_in)
|
struct htlc_in_map *unconnected_htlcs_in STEALS)
|
||||||
{
|
{
|
||||||
struct htlc_in *hin;
|
struct htlc_in *hin;
|
||||||
struct htlc_in_map_iter ini;
|
struct htlc_in_map_iter ini;
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ void htlcs_notify_new_block(struct lightningd *ld, u32 height);
|
|||||||
void fixup_htlcs_out(struct lightningd *ld);
|
void fixup_htlcs_out(struct lightningd *ld);
|
||||||
|
|
||||||
void htlcs_resubmit(struct lightningd *ld,
|
void htlcs_resubmit(struct lightningd *ld,
|
||||||
struct htlc_in_map *unconnected_htlcs_in);
|
struct htlc_in_map *unconnected_htlcs_in STEALS);
|
||||||
|
|
||||||
/* For HTLCs which terminate here, invoice payment calls one of these. */
|
/* For HTLCs which terminate here, invoice payment calls one of these. */
|
||||||
void fulfill_htlc(struct htlc_in *hin, const struct preimage *preimage);
|
void fulfill_htlc(struct htlc_in *hin, const struct preimage *preimage);
|
||||||
|
|||||||
Reference in New Issue
Block a user