From c4bbb7530323cdc7decda276073083e8278736b3 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Mon, 23 Aug 2021 12:08:42 -0700 Subject: [PATCH] TMXR: Fix potential memory leak when already out of memory --- sim_tmxr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sim_tmxr.c b/sim_tmxr.c index 43f05e86..e5e40f95 100644 --- a/sim_tmxr.c +++ b/sim_tmxr.c @@ -5233,7 +5233,8 @@ if (set == NULL) { /* if the allocation fai tbuf = (char *) calloc (strlen(cptr)+2, sizeof(*cptr)); if (tbuf == NULL) { /* if the allocation failed */ - free (tbuf); /* then free the successful list allocation */ + free (set); /* then free the line set tracking array */ + free (list); /* and successful list allocation */ return SCPE_MEM; /* and report a "Memory exhausted" error */ }