Stopped memory leak in continuation cards when removing old cards.

This commit is contained in:
Brian Taylor 2022-05-10 11:04:04 -07:00 committed by Holger Vogt
parent fff87ebb81
commit d41bff8373
1 changed files with 7 additions and 2 deletions

View File

@ -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);
}