From f3c535b45a63ead86705ab710c80aacfa3f56bd8 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Mon, 11 Apr 2016 14:21:43 +0100
Subject: [PATCH] Get rid of the parts if we don't have any

---
 examples/main.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/examples/main.c b/examples/main.c
index 4d26252dbc..d453847303 100644
--- a/examples/main.c
+++ b/examples/main.c
@@ -344,6 +344,12 @@ int main(int argc, char *argv[]) {
     for (size_t k = 0; k < Ngas; ++k) parts[k].gpart = NULL;
     Ngpart = 0;
   }
+  if (!with_hydro) {
+    free(parts);
+    parts = NULL;
+    for (size_t k = 0; k < Ngpart; ++k) if(gparts[k].id > 0) error("Linking problem");
+    Ngas = 0;
+  }
 
   /* Get the total number of particles across all nodes. */
   long long N_total[2] = {0, 0};
-- 
GitLab