diff --git a/state.c b/state.c index 60e8ad3a4..a440d00bb 100644 --- a/state.c +++ b/state.c @@ -547,7 +547,7 @@ struct state_effect *state(const tal_t *ctx, return next_state(ctx, effect, STATE_CLOSE_WAIT_CLOSE); } else if (input_is(input, PKT_ERROR)) { add_effect(&effect, in_error, - set_errpkt(ctx, idata->pkt)); + tal_steal(ctx, idata->pkt)); goto start_unilateral_close_already_closing; } else if (input_is_pkt(input)) { /* We ignore all other packets while closing. */ @@ -845,7 +845,7 @@ unexpected_pkt: */ /* Don't reply to an error with an error. */ if (input_is(input, PKT_ERROR)) { - add_effect(&effect, in_error, set_errpkt(ctx, idata->pkt)); + add_effect(&effect, in_error, tal_steal(ctx, idata->pkt)); goto start_unilateral_close; } err = unexpected_pkt(ctx, input); diff --git a/test/test_state_coverage.c b/test/test_state_coverage.c index 9a65c5b8d..61e17b008 100644 --- a/test/test_state_coverage.c +++ b/test/test_state_coverage.c @@ -482,12 +482,6 @@ static enum state_input input_by_name(const char *name) abort(); } -/* We don't bother with lifetime issues */ -static Pkt *set_errpkt(const tal_t *ctx, const Pkt *pkt) -{ - return (Pkt *)pkt; -} - static Pkt *new_pkt(const tal_t *ctx, enum state_input i) { return (Pkt *)input_name(i);