Browse Source
For now we just check for outstanding take() or tal_tmpctx(). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>ppa-0.6.1
5 changed files with 38 additions and 5 deletions
@ -0,0 +1,19 @@ |
|||||
|
#include <ccan/err/err.h> |
||||
|
#include <ccan/take/take.h> |
||||
|
#include <common/io_debug.h> |
||||
|
#include <common/utils.h> |
||||
|
|
||||
|
int debug_poll(struct pollfd *fds, nfds_t nfds, int timeout) |
||||
|
{ |
||||
|
const char *t; |
||||
|
|
||||
|
t = taken_any(); |
||||
|
if (t) |
||||
|
errx(1, "Outstanding taken pointers: %s", t); |
||||
|
|
||||
|
t = tmpctx_any(); |
||||
|
if (t) |
||||
|
errx(1, "Outstanding tmpctx: %s", t); |
||||
|
|
||||
|
return poll(fds, nfds, timeout); |
||||
|
} |
@ -0,0 +1,9 @@ |
|||||
|
#ifndef LIGHTNING_COMMON_IO_DEBUG_H |
||||
|
#define LIGHTNING_COMMON_IO_DEBUG_H |
||||
|
#include "config.h" |
||||
|
#include <poll.h> |
||||
|
|
||||
|
/* Replacement poll which checks for memory leaks in middle of ccan/io loop. */ |
||||
|
int debug_poll(struct pollfd *fds, nfds_t nfds, int timeout); |
||||
|
|
||||
|
#endif /* LIGHTNING_COMMON_IO_DEBUG_H */ |
Loading…
Reference in new issue