From 578d08d788719cf15f384a7ccf17c2c686d49dfa Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Mon, 25 Apr 2022 17:04:06 +0200
Subject: [PATCH] Do not attempt to free the mesh when running without periodic
 BCs

---
 examples/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/main.c b/examples/main.c
index 1c340bbf7b..dec11ace5e 100644
--- a/examples/main.c
+++ b/examples/main.c
@@ -1848,7 +1848,7 @@ int main(int argc, char *argv[]) {
   if (with_cosmology) cosmology_clean(e.cosmology);
   if (e.neutrino_properties->use_linear_response)
     neutrino_response_clean(e.neutrino_response);
-  if (with_self_gravity) pm_mesh_clean(e.mesh);
+  if (with_self_gravity && s.periodic) pm_mesh_clean(e.mesh);
   if (with_stars) stars_props_clean(e.stars_properties);
   if (with_cooling || with_temperature) cooling_clean(e.cooling_func);
   if (with_feedback) feedback_clean(e.feedback_props);
-- 
GitLab