aboutsummaryrefslogtreecommitdiff
path: root/path.c
diff options
context:
space:
mode:
authorKirill Petrashin <kirill8201@yandex.ru>2026-03-28 18:15:31 +0300
committerKirill Petrashin <kirill8201@yandex.ru>2026-03-28 18:15:31 +0300
commit5b623c0a31d6732dd03ba8db80004e5468bc08c3 (patch)
treea997548d546d6a8615a2d9afcbf94477bd901e9c /path.c
parent788744ac322684b64a02e4661bde59e4e565afa2 (diff)
downloadastar-5b623c0a31d6732dd03ba8db80004e5468bc08c3.tar.xz
Free the path when we return NULL instead of it
Diffstat (limited to 'path.c')
-rw-r--r--path.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/path.c b/path.c
index 033f881..60f1482 100644
--- a/path.c
+++ b/path.c
@@ -76,6 +76,7 @@ Path breadth_first_search_path(int dirs, Map map, size_t width, size_t height, P
if (should_anim) {
if (anim(map, width, height, start, end, &cur, visited, frontier) == -1) {
clear();
+ path_free(path, height);
return NULL;
}
}
@@ -85,6 +86,7 @@ Path breadth_first_search_path(int dirs, Map map, size_t width, size_t height, P
clear();
}
+ path_free(path, height);
return NULL;
}