aboutsummaryrefslogtreecommitdiff
path: root/map.c
diff options
context:
space:
mode:
authorKirill Petrashin <kirill8201@yandex.ru>2026-03-26 13:42:59 +0300
committerKirill Petrashin <kirill8201@yandex.ru>2026-03-26 13:42:59 +0300
commit0a6f8b49723aa8da143953bc011582542d2f2010 (patch)
treed2fb6216ff0815a8539d3b315e188181e98bbf89 /map.c
parent5bf01bf1955cb1be6dc498543f8b2064b3424177 (diff)
downloadastar-0a6f8b49723aa8da143953bc011582542d2f2010.tar.xz
Fix memory leaks
Diffstat (limited to 'map.c')
-rw-r--r--map.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/map.c b/map.c
index 9f1d206..2966437 100644
--- a/map.c
+++ b/map.c
@@ -313,6 +313,14 @@ void draw_map(Map map, size_t width, size_t height, int offset_x, int offset_y,
doupdate();
}
+void map_free(Map map, size_t height) {
+ if (map == NULL) return;
+ for (size_t i = 0; i < height; i++) {
+ free(map[i]);
+ }
+ free(map);
+}
+
void print_map_out(Map map, size_t width, size_t height) {
for (size_t i = 0; i < height; i++) {
for (size_t j = 0; j < width; j++) {