[cig-commits] r7234 - in short/3D/PyLith/trunk/libsrc: faults materials

brad at geodynamics.org brad at geodynamics.org
Thu Jun 14 10:10:09 PDT 2007


Author: brad
Date: 2007-06-14 10:10:08 -0700 (Thu, 14 Jun 2007)
New Revision: 7234

Modified:
   short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.cc
   short/3D/PyLith/trunk/libsrc/materials/Material.cc
Log:
Fixed memory problems associated with deleting null pointer of FieldsManager which contains a const reference to ALE::Obj<Mesh> (shared pointer).

Modified: short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.cc	2007-06-14 17:08:58 UTC (rev 7233)
+++ short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.cc	2007-06-14 17:10:08 UTC (rev 7234)
@@ -62,7 +62,8 @@
   const int spaceDim = cs->spaceDim();
 
   // Create and allocate sections for parameters
-  delete _parameters; 
+  if (0 != _parameters) // Can't delete NULL pointer that holds reference
+    delete _parameters; 
   _parameters = new topology::FieldsManager(mesh);
   if (0 == _parameters)
     throw std::runtime_error("Could not create manager for parameters of "

Modified: short/3D/PyLith/trunk/libsrc/materials/Material.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/Material.cc	2007-06-14 17:08:58 UTC (rev 7233)
+++ short/3D/PyLith/trunk/libsrc/materials/Material.cc	2007-06-14 17:10:08 UTC (rev 7234)
@@ -77,7 +77,8 @@
   } // if
 
   // Create sections to hold parameters for physical properties
-  if (_parameters) {delete _parameters;};
+  if (0 != _parameters) // Can't delete NULL pointer that holds reference
+    delete _parameters;
   _parameters = new topology::FieldsManager(mesh);
   assert(0 != _parameters);
   const int numQuadPts = quadrature->numQuadPts();



More information about the cig-commits mailing list