shithub: puzzles

Download patch

ref: 11b631ea870355306c4b1d03458bb3cea8f29188
parent: 0f20b7226957a2fceff37a67b0d9874c7db3a7fc
author: Ben Harris <bjh21@bjh21.me.uk>
date: Mon Feb 13 04:45:08 EST 2023

Don't leak grids in Loopy's validate_desc()

--- a/loopy.c
+++ b/loopy.c
@@ -791,13 +791,18 @@
             count += *desc - 'a' + 1;
             continue;
         }
+        grid_free(g);
         return "Unknown character in description";
     }
 
-    if (count < g->num_faces)
+    if (count < g->num_faces) {
+        grid_free(g);
         return "Description too short for board size";
-    if (count > g->num_faces)
+    }
+    if (count > g->num_faces) {
+        grid_free(g);
         return "Description too long for board size";
+    }
 
     grid_free(g);