TMXR: Fix potential memory leak when already out of memory

This commit is contained in:
Mark Pizzolato 2021-08-23 12:08:42 -07:00
parent 64b1223468
commit c4bbb75303

View file

@ -5233,7 +5233,8 @@ if (set == NULL) { /* if the allocation fai
tbuf = (char *) calloc (strlen(cptr)+2, sizeof(*cptr)); tbuf = (char *) calloc (strlen(cptr)+2, sizeof(*cptr));
if (tbuf == NULL) { /* if the allocation failed */ 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 */ return SCPE_MEM; /* and report a "Memory exhausted" error */
} }