common: add tal_gather_wally() function to reparent libwally objs.

This lets us reduce leaks, and ease their detection.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2020-09-22 19:23:37 +09:30
parent 3c8049f32c
commit a316c517c7
3 changed files with 16 additions and 2 deletions

View File

@@ -84,6 +84,9 @@ void setup_tmpctx(void);
/* Free any children of tmpctx. */
void clean_tmpctx(void);
/* Steal any wally allocations onto this context. */
void tal_gather_wally(const tal_t *ctx);
/* Define sha256_eq. */
STRUCTEQ_DEF(sha256, 0, u);
@@ -106,4 +109,7 @@ STRUCTEQ_DEF(ripemd160, 0, u);
#define IFDEV(dev, nondev) (nondev)
#endif
/* Context which all wally allocations use (see common/setup.c) */
extern const tal_t *wally_tal_ctx;
#endif /* LIGHTNING_COMMON_UTILS_H */