certi-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[certi-cvs] certi/libCERTI Object.cc


From: certi-cvs
Subject: [certi-cvs] certi/libCERTI Object.cc
Date: Wed, 24 Sep 2008 12:53:11 +0000

CVSROOT:        /sources/certi
Module name:    certi
Changes by:     Eric NOULARD <erk>      08/09/24 12:53:11

Modified files:
        libCERTI       : Object.cc 

Log message:
        Fix bug #24362 : Memleak in ObjectClass

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/Object.cc?cvsroot=certi&r1=3.23&r2=3.24

Patches:
Index: Object.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/Object.cc,v
retrieving revision 3.23
retrieving revision 3.24
diff -u -b -r3.23 -r3.24
--- Object.cc   18 Sep 2008 17:13:32 -0000      3.23
+++ Object.cc   24 Sep 2008 12:53:11 -0000      3.24
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: Object.cc,v 3.23 2008/09/18 17:13:32 erk Exp $
+// $Id: Object.cc,v 3.24 2008/09/24 12:53:11 erk Exp $
 // ----------------------------------------------------------------------------
 
 
@@ -31,6 +31,7 @@
 #include <iostream>
 #include <cstring>
 #include <algorithm>
+#include <functional>
 
 using std::cout ;
 using std::endl ;
@@ -47,11 +48,22 @@
     setName(the_name);
 }
 
+template <class T>
+struct delme : public std::unary_function<T, void> {
+  void operator() (T& x) {
+    delete x;
+  }
+};
+
 // ----------------------------------------------------------------------------
 //! Destructor.
 Object::~Object()
 {
     sf.clear();
+    // We should delete the pointee because it belongs to the object.
+    for (std::deque<ObjectAttribute *>::iterator i = attributeState.begin(); 
i!=attributeState.end();++i) {
+       delete (*i);
+    }
     attributeState.clear();
 }
 
@@ -148,4 +160,4 @@
 
 } // namespace certi
 
-// $Id: Object.cc,v 3.23 2008/09/18 17:13:32 erk Exp $
+// $Id: Object.cc,v 3.24 2008/09/24 12:53:11 erk Exp $




reply via email to

[Prev in Thread] Current Thread [Next in Thread]