src/main.c

changeset 138
bcd6100373ef
parent 133
c58ae152733e
--- a/src/main.c	Fri Jun 12 15:32:33 2026 +0200
+++ b/src/main.c	Sat Jun 13 13:24:54 2026 +0200
@@ -900,15 +900,18 @@
             if (result) {
                 printw("Invalid PGN file content at position %ld:\n%s\n",
                         position, pgn_error_str(result));
+                gamestate_cleanup(&gamestate);
                 return;
             }
             if (!is_game_running(&gamestate)) {
                 addstr("Game has ended. Use -S to analyze it.\n");
+                gamestate_cleanup(&gamestate);
                 return;
             }
             curcol = current_color(&gamestate);
         } else {
             printw("Can't read PGN file (%s)\n", strerror(errno));
+            gamestate_cleanup(&gamestate);
             return;
         }
     }

mercurial