mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
libplugin: mark the cmd notleak() whenever command_still_pending() called.
This is what we do in lightningd, which makes memleak much more forgiving: you can hang temporaries off cmd without getting reports of leaks (also when send_outreq called). We remove all the notleak() calls in plugins which worked around this! And avoid multiple notleak labels, since both send_outreq() and command_still_pending() can be called multiple times. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -297,6 +297,8 @@ struct command_result *command_finished(struct command *cmd,
|
||||
struct command_result *WARN_UNUSED_RESULT
|
||||
command_still_pending(struct command *cmd)
|
||||
{
|
||||
if (cmd)
|
||||
notleak_with_children(cmd);
|
||||
return &pending;
|
||||
}
|
||||
|
||||
@@ -728,6 +730,8 @@ send_outreq(struct plugin *plugin, const struct out_req *req)
|
||||
|
||||
ld_rpc_send(plugin, req->js);
|
||||
|
||||
if (req->cmd != NULL)
|
||||
notleak_with_children(req->cmd);
|
||||
return &pending;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user