From 375aab6daa24d5e96a5199058ac53693915754d5 Mon Sep 17 00:00:00 2001
From: Jan Thorbecke <janth@xs4all.nl>
Date: Thu, 2 Feb 2017 16:47:50 +0100
Subject: [PATCH] deallocate static in boundaries

---
 fdelmodc/boundaries.c | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/fdelmodc/boundaries.c b/fdelmodc/boundaries.c
index 965d026..cbceb20 100644
--- a/fdelmodc/boundaries.c
+++ b/fdelmodc/boundaries.c
@@ -1113,6 +1113,17 @@ tzz[ix*n1+iz], txz[ix*n1+iz], txx[ix*n1+iz], lam[ix*n1+iz], l2m[ix*n1+iz]);
 
 	}
 
+    if ( (npml != 0) && (itime==mod.nt-1) && pml) {
+#pragma omp master
+{
+		if (allocated) {
+            free(Vxpml);
+        	free(Vzpml);
+        	free(sigmu);
+        	free(RA);
+		}
+}
+	}
 
 	return 0;
 } 
@@ -1648,9 +1659,19 @@ int boundariesV(modPar mod, bndPar bnd, float *vx, float *vz, float *tzz, float
 				}
 			}
 		}
-
-		
 	}
 	
+    if ( (npml != 0) && (itime==mod.nt-1) && pml) {
+#pragma omp master
+{
+		if (allocated) {
+            free(Pxpml);
+        	free(Pzpml);
+        	free(sigmu);
+        	free(RA);
+		}
+}
+	}
+
 	return 0;
 }
-- 
GitLab