mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
df: patch for valgrind error
We were freeing the payload, which is then subsequently freed by the plugin_hook caller. Whoops. Now we pass through to the callback function and just clean up neatly. ------------------------------- Valgrind errors -------------------------------- Valgrind error file: valgrind-errors.406602 ==406602== Invalid read of size 8 ==406602== at 0x12AC93: openchannel2_hook_cb (dual_open_control.c:669) ==406602== by 0x12AF0A: openchannel2_hook_deserialize (dual_open_control.c:721) ==406602== by 0x16EF0E: plugin_hook_callback (plugin_hook.c:186) ==406602== by 0x169746: plugin_response_handle (plugin.c:514) ==406602== by 0x169959: plugin_read_json_one (plugin.c:620) ==406602== by 0x169B23: plugin_read_json (plugin.c:665) ==406602== by 0x1F4076: next_plan (io.c:59) ==406602== by 0x1F4C5B: do_plan (io.c:407) ==406602== by 0x1F4C9D: io_ready (io.c:417) ==406602== by 0x1F6F35: io_loop (poll.c:445) ==406602== by 0x13D48D: io_loop_with_timers (io_loop_with_timers.c:24) ==406602== by 0x143388: main (lightningd.c:1111) ==406602== Address 0x75e7418 is 56 bytes inside a block of size 3,520 free'd ==406602== at 0x483CA3F: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) ==406602== by 0x204FB0: del_tree (tal.c:421) ==406602== by 0x20527E: tal_free (tal.c:486) ==406602== by 0x122D68: delete_channel (channel.c:124) ==406602== by 0x129291: channel_disconnect (dual_open_control.c:63) ==406602== by 0x129364: channel_close_conn (dual_open_control.c:82) ==406602== by 0x131CF6: peer_please_disconnect (connect_control.c:304) ==406602== by 0x131DEB: connectd_msg (connect_control.c:326) ==406602== by 0x172023: sd_msg_read (subd.c:509) ==406602== by 0x1F4076: next_plan (io.c:59) ==406602== by 0x1F4C5B: do_plan (io.c:407) ==406602== by 0x1F4C9D: io_ready (io.c:417) ==406602== Block was alloc'd at ==406602== at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) ==406602== by 0x204A39: allocate (tal.c:250) ==406602== by 0x204FFA: tal_alloc_ (tal.c:428) ==406602== by 0x123165: new_unsaved_channel (channel.c:209) ==406602== by 0x130D34: peer_start_dualopend (dual_open_control.c:2985) ==406602== by 0x15BD2A: peer_connected_hook_final (peer_control.c:1105) ==406602== by 0x16F2E5: plugin_hook_call_ (plugin_hook.c:275) ==406602== by 0x15BF5C: plugin_hook_call_peer_connected (peer_control.c:1155) ==406602== by 0x15C16C: peer_connected (peer_control.c:1208) ==406602== by 0x131E3B: connectd_msg (connect_control.c:332) ==406602== by 0x172023: sd_msg_read (subd.c:509) ==406602== by 0x171842: read_fds (subd.c:310)
This commit is contained in:
parent
6d3fb11bc6
commit
5ee4c9e46c
@ -660,9 +660,6 @@ openchannel2_hook_cb(struct openchannel2_payload *payload STEALS)
|
||||
struct channel *channel = payload->channel;
|
||||
u8 *msg;
|
||||
|
||||
/* Free payload regardless of what happens next */
|
||||
tal_steal(tmpctx, payload);
|
||||
|
||||
/* Our daemon died, we fail and try to reconnect */
|
||||
if (!dualopend) {
|
||||
channel_err_broken(channel, "Lost conn to node %s"
|
||||
@ -673,6 +670,9 @@ openchannel2_hook_cb(struct openchannel2_payload *payload STEALS)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Free payload regardless of what happens next */
|
||||
tal_steal(tmpctx, payload);
|
||||
|
||||
channel = dualopend->channel;
|
||||
|
||||
/* Channel open is currently in progress elsewhere! */
|
||||
@ -716,7 +716,7 @@ openchannel2_hook_deserialize(struct openchannel2_payload *payload,
|
||||
|
||||
/* If our daemon died, we're done */
|
||||
if (!dualopend) {
|
||||
tal_free(payload);
|
||||
openchannel2_hook_cb(payload);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user