From de844d48c42d871011a394fc0ff47155fdbdd54f Mon Sep 17 00:00:00 2001 From: Gorilla Sapiens Date: Thu, 19 Jun 2025 22:36:16 +0000 Subject: [PATCH 1/2] fixes #2714 --- src/cl65/main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cl65/main.c b/src/cl65/main.c index 528e64e56..d1e1baa1b 100644 --- a/src/cl65/main.c +++ b/src/cl65/main.c @@ -1715,10 +1715,14 @@ int main (int argc, char* argv []) /* Link the given files if requested and if we have any */ if (DoLink && LD65.FileCount > 0) { + /* + ** Link() may not return if there's an error, so we install + ** RemoveTempFiles() as an atexit() handler. + */ + atexit(RemoveTempFiles); Link (); } - RemoveTempFiles (); if (OutputDirectory != NULL) { xfree(OutputDirectory); } From fa4d704ee85eb508b136e978b62afb4a5b92f905 Mon Sep 17 00:00:00 2001 From: Bob Andrews Date: Fri, 20 Jun 2025 17:53:52 +0200 Subject: [PATCH 2/2] Update main.c - codestyle --- src/cl65/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cl65/main.c b/src/cl65/main.c index d1e1baa1b..6f2fe03df 100644 --- a/src/cl65/main.c +++ b/src/cl65/main.c @@ -1719,7 +1719,7 @@ int main (int argc, char* argv []) ** Link() may not return if there's an error, so we install ** RemoveTempFiles() as an atexit() handler. */ - atexit(RemoveTempFiles); + atexit (RemoveTempFiles); Link (); }