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 6 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 daemon *daemon;
/* daemon->peers */
struct list_node list;
struct daemon *daemon;
/* The ID of the peer (not necessarily unique, in transit!) */
struct pubkey id;
@ -2261,9 +2261,6 @@ int main(int argc, char *argv[])
daemon_conn_init(daemon, &daemon->connectd, CONNECTD_FD, connectd_req,
NULL);
/* When conn closes, everything is freed. */
tal_steal(daemon->master.conn, daemon);
for (;;) {
struct timer *expired = NULL;
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 */
char *fmt_wireaddr_without_port(const tal_t *ctx UNNEEDED, const struct wireaddr *a UNNEEDED)
{ 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 */
struct json {

Loading…
Cancel
Save