Browse Source

gossipd: minor modifications for memleak detection to work.

1. Move the list to the start of `struct peer`: memleak walks the
   list correctly this way.
2. Don't create tal parent loop daemon->conn->daemon.

The second one is silly anyway: we exit via master_gone when the master
conn is closed.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 7 years ago
committed by Christian Decker
parent
commit
2db77f5d1d
  1. 7
      gossipd/gossip.c
  2. 4
      lightningd/test/run-param.c

7
gossipd/gossip.c

@ -119,11 +119,11 @@ struct daemon {
}; };
struct peer { struct peer {
struct daemon *daemon;
/* daemon->peers */ /* daemon->peers */
struct list_node list; struct list_node list;
struct daemon *daemon;
/* The ID of the peer (not necessarily unique, in transit!) */ /* The ID of the peer (not necessarily unique, in transit!) */
struct pubkey id; struct pubkey id;
@ -2261,9 +2261,6 @@ int main(int argc, char *argv[])
daemon_conn_init(daemon, &daemon->connectd, CONNECTD_FD, connectd_req, daemon_conn_init(daemon, &daemon->connectd, CONNECTD_FD, connectd_req,
NULL); NULL);
/* When conn closes, everything is freed. */
tal_steal(daemon->master.conn, daemon);
for (;;) { for (;;) {
struct timer *expired = NULL; struct timer *expired = NULL;
io_loop(&daemon->timers, &expired); io_loop(&daemon->timers, &expired);

4
lightningd/test/run-param.c

@ -48,10 +48,6 @@ void command_fail_detailed(struct command *cmd, int code,
/* Generated stub for fmt_wireaddr_without_port */ /* Generated stub for fmt_wireaddr_without_port */
char *fmt_wireaddr_without_port(const tal_t *ctx UNNEEDED, const struct wireaddr *a UNNEEDED) char *fmt_wireaddr_without_port(const tal_t *ctx UNNEEDED, const struct wireaddr *a UNNEEDED)
{ fprintf(stderr, "fmt_wireaddr_without_port called!\n"); abort(); } { fprintf(stderr, "fmt_wireaddr_without_port called!\n"); abort(); }
/* Generated stub for json_tok_wtx */
bool json_tok_wtx(struct wallet_tx * tx UNNEEDED, const char * buffer UNNEEDED,
const jsmntok_t * sattok UNNEEDED, u64 max UNNEEDED)
{ fprintf(stderr, "json_tok_wtx called!\n"); abort(); }
/* AUTOGENERATED MOCKS END */ /* AUTOGENERATED MOCKS END */
struct json { struct json {

Loading…
Cancel
Save