[Ptinpoly-commits] r29 - pkg/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Aug 20 15:02:31 CEST 2014


Author: jmaisog
Date: 2014-08-20 15:02:28 +0200 (Wed, 20 Aug 2014)
New Revision: 29

Modified:
   pkg/src/pinpolyhedronA.cc
Log:
Added code to release memory if an exception is thrown and the C++ wrapper function is exited (both 2D and 3D functions).

Modified: pkg/src/pinpolyhedronA.cc
===================================================================
--- pkg/src/pinpolyhedronA.cc	2014-08-17 19:11:30 UTC (rev 28)
+++ pkg/src/pinpolyhedronA.cc	2014-08-20 13:02:28 UTC (rev 29)
@@ -777,6 +777,11 @@
             vert[i][1] += minY;
             vert[i][2] += minZ;
         }
+
+        // RELEASE MEMORY!!
+        delete [] tris;
+        delete [] vert;
+        if ( ptpoly != 0 ) delete ptpoly;
         return;
     }
 
@@ -1938,6 +1943,11 @@
             vert[i][0] += minX;
             vert[i][1] += minY;
         }
+
+        // RELEASE MEMORY!!
+        delete [] vert;
+        if ( ptpoly != 0 ) delete ptpoly;
+
         return;
     }
 



More information about the Ptinpoly-commits mailing list