Commits

Adrien Saladin committed 04b584c

fixed memory leak within attractforcefield.pyx

Comments (0)

Files changed (1)

attractforcefield.pyx

         c_filename = <char*> filename
         cppname = new string(c_filename)
         self.rigidlist = []
-        
         self.thisptr = new CppAttractForceField2(deref(cppname), cutoff)
+        del cppname
 
     def __dealloc__(self):
         del self.thisptr
 
         c_filename = <char*> filename
         cppname = new string(c_filename)
-        
         self.thisptr = new CppAttractForceField1(deref(cppname), cutoff)
+        del cppname
+
+    def __dealloc__(self):
+        del self.thisptr
 
     def AddLigand(self, AttractRigidbody rig):
         self.thisptr.AddLigand(deref(rig.thisptr))