gossipd: free tmpctx children in gossip_store_load loop.

We're accumulating children, and we'll get more in the successive
patches.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2019-04-11 14:45:22 +09:30 committed by neil saitug
parent 3ef767fd52
commit cb297b0a1b

View file

@ -438,7 +438,7 @@ void gossip_store_load(struct routing_state *rstate, struct gossip_store *gs)
read(fd, &becsum, sizeof(becsum)) == sizeof(becsum)) {
msglen = be32_to_cpu(belen);
checksum = be32_to_cpu(becsum);
msg = tal_arr(gs, u8, msglen);
msg = tal_arr(tmpctx, u8, msglen);
if (read(fd, msg, msglen) != msglen) {
status_unusual("gossip_store: truncated file?");
@ -496,7 +496,7 @@ void gossip_store_load(struct routing_state *rstate, struct gossip_store *gs)
}
gs->len += sizeof(belen) + sizeof(becsum) + msglen;
gs->count++;
tal_free(msg);
clean_tmpctx();
}
goto out;