subd: fix false positive if we're inside a subd_req.

We're going to call out to subds for memleak detection, and the disabler
looks like a memleak if we're inside a callback.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-08-24 14:50:06 +09:30
committed by Christian Decker
parent 37ea0d3c7f
commit aa62d79db2

View File

@@ -10,6 +10,7 @@
#include <common/crypto_state.h>
#include <common/gen_peer_status_wire.h>
#include <common/gen_status_wire.h>
#include <common/memleak.h>
#include <errno.h>
#include <fcntl.h>
#include <lightningd/lightningd.h>
@@ -91,7 +92,7 @@ static void add_req(const tal_t *ctx,
* case where ctx is freed between request and reply. Hence this
* trick. */
if (ctx) {
sr->disabler = tal(ctx, char);
sr->disabler = notleak(tal(ctx, char));
tal_add_destructor2(sr->disabler, disable_cb, sr);
} else
sr->disabler = NULL;