From d41bff837336642f385a28264ea0fa78af9e5946 Mon Sep 17 00:00:00 2001 From: Brian Taylor Date: Tue, 10 May 2022 11:04:04 -0700 Subject: [PATCH] Stopped memory leak in continuation cards when removing old cards. --- src/frontend/inpcom.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index ffbd2aa35..a93fe2a3f 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -8311,12 +8311,17 @@ static struct card *the_last_card(struct card *startcard) } static void remove_old_cards(struct card *first, struct card *stop) { - struct card *x, *next = NULL; + struct card *x, *y, *next = NULL, *nexta = NULL; if (!first || !stop || (first == stop)) { return; } for (x = first; (x && (x != stop)); x = next) { - //printf("Remove %s\n", x->line); if (x->line) { tfree(x->line); } if (x->error) { tfree(x->error); } + for (y = x->actualLine; y; y = nexta) { + if (y->line) { tfree(y->line); } + if (y->error) { tfree(y->error); } + nexta = y->nextcard; + tfree(y); + } next = x->nextcard; tfree(x); }