cryptopkt: free output packets after encryption.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2016-11-01 21:34:58 +10:30
parent 95a01670ac
commit 642a2f2d4e

View File

@ -331,6 +331,8 @@ struct io_plan *peer_write_packet(struct io_conn *conn,
tal_free(iod->out.cpkt);
iod->out.cpkt = encrypt_pkt(iod, pkt, &totlen);
/* Free unencrypted packet. */
tal_free(pkt);
return io_write(conn, iod->out.cpkt, totlen, next, peer);
}