diff --git a/Geo/Geo.cpp b/Geo/Geo.cpp
index ee81b72af36aa91bcc56e3b91dda991e8e3766fe..37305236b81401d592a7f2280c50d82809632af2 100644
--- a/Geo/Geo.cpp
+++ b/Geo/Geo.cpp
@@ -2208,20 +2208,24 @@ static List_T *GetCompoundUniqueEdges(Surface *ps)
 // loop.
 // Only one problem: Sometimes holes can be selected as the first loop, though
 // this should not create many real problems on a copied top surface.
-static List_T* GetOrderedUniqueEdges( Surface *s )
+static List_T* GetOrderedUniqueEdges(Surface *s)
 {
   List_T* unique = GetCompoundUniqueEdges(s);
+  if(!unique) return 0;
 
   // need to sort out the list into ordered, oriented loops before passing
   // these into the gmsh geometry system.
   // Have to get list of surface numbers
   int numgen = List_Nbr(unique);
 
-  if(!numgen) return 0;
+  if(!numgen){
+    List_Delete(unique);
+    return 0;
+  }
 
   List_T *gen_nums = List_Create(numgen, 1, sizeof(int));
 
-  for( int i = 0; i < numgen; i++ ){
+  for(int i = 0; i < numgen; i++){
     Curve *ctemp = 0;
     List_Read(unique, i, &ctemp);
     if( !ctemp ){
@@ -2232,11 +2236,11 @@ static List_T* GetOrderedUniqueEdges( Surface *s )
     List_Add(gen_nums, &(ctemp->Num));
   }
 
-  sortEdgesInLoop(0,gen_nums,1);
+  sortEdgesInLoop(0, gen_nums, 1);
 
   // put sorted list of curve pointers back into compnd_gen and generatrices
   List_Reset(unique);
-  for( int i = 0; i < List_Nbr(gen_nums); i++ ){
+  for(int i = 0; i < List_Nbr(gen_nums); i++){
     Curve *ctemp = 0;
     int j;
     List_Read(gen_nums, i, &j);
@@ -2256,7 +2260,6 @@ static List_T* GetOrderedUniqueEdges( Surface *s )
 
 static int compareTwoPoints(const void *a, const void *b)
 {
-
   Vertex *q = *(Vertex **)a;
   Vertex *w = *(Vertex **)b;
 
@@ -2359,7 +2362,7 @@ static void MaxNumSurface(void *a, void *b)
 static void ReplaceDuplicatePointsNew(double tol = -1.)
 {
   Msg::Info("New Coherence...");
-  if (tol < 0) 
+  if (tol < 0)
     tol = CTX::instance()->geom.tolerance * CTX::instance()->lc;
 
   // create kdtree
@@ -2929,7 +2932,7 @@ void ReplaceAllDuplicates()
 
 void ReplaceAllDuplicatesNew(double tol)
 {
-  if (tol < 0) 
+  if (tol < 0)
     tol = CTX::instance()->geom.tolerance * CTX::instance()->lc;
   ReplaceDuplicatePointsNew(tol);
   ReplaceDuplicateCurves(NULL);
diff --git a/Geo/GeomMeshMatcher.cpp b/Geo/GeomMeshMatcher.cpp
index 79ddb234ca7652e533ba6aa5759d7dbdf07f71bf..b1c28419b1a98beae5ed12c4ebf7608d99a8f56b 100644
--- a/Geo/GeomMeshMatcher.cpp
+++ b/Geo/GeomMeshMatcher.cpp
@@ -711,5 +711,9 @@ int GeomMeshMatcher::match(GModel *geom, GModel *mesh)
   copy_vertices(geom, mesh, _mesh_to_geom,coresp_v,coresp_e,coresp_f);
   copy_elements(geom, mesh, _mesh_to_geom,coresp_v,coresp_e,coresp_f);
 
+  delete coresp_v;
+  delete coresp_e;
+  delete coresp_f;
+
   return 1;
 }