certi-cvs
[Top][All Lists]
Advanced

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

[certi-cvs] certi/RTIA FederationManagement.hh FederationMa...


From: certi-cvs
Subject: [certi-cvs] certi/RTIA FederationManagement.hh FederationMa...
Date: Tue, 29 Apr 2008 13:11:15 +0000

CVSROOT:        /sources/certi
Module name:    certi
Changes by:     Eric NOULARD <erk>      08/04/29 13:11:15

Modified files:
        RTIA           : FederationManagement.hh FederationManagement.cc 

Log message:
        Replace char* with std::string in order to avoid some mem leak

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/FederationManagement.hh?cvsroot=certi&r1=3.21&r2=3.22
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/FederationManagement.cc?cvsroot=certi&r1=3.58&r2=3.59

Patches:
Index: FederationManagement.hh
===================================================================
RCS file: /sources/certi/certi/RTIA/FederationManagement.hh,v
retrieving revision 3.21
retrieving revision 3.22
diff -u -b -r3.21 -r3.22
--- FederationManagement.hh     17 Dec 2007 16:01:24 -0000      3.21
+++ FederationManagement.hh     29 Apr 2008 13:11:14 -0000      3.22
@@ -18,7 +18,7 @@
 // along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: FederationManagement.hh,v 3.21 2007/12/17 16:01:24 rousse Exp $
+// $Id: FederationManagement.hh,v 3.22 2008/04/29 13:11:14 erk Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef _CERTI_RTIA_FEDERATION_MANAGEMENT
@@ -100,7 +100,7 @@
     Handle _numero_federation ;
     FederateHandle federate ;
     bool _fin_execution ;
-    char *_FEDid ;
+    char*  _FEDid ;
 
 private:
     Communications *comm ;
@@ -114,12 +114,13 @@
 
     std::list<char *> synchronizationLabels ; //!< Labels being synchronized.
 
-    char *_nom_federation ;
-    char _nom_federe[MAX_FEDERATE_NAME_LENGTH] ;
+    std::string _nom_federation ;
+    std::string _nom_federe;
+    
 };
 
 }} // namespace certi/rtia
 
 #endif // _CERTI_RTIA_FEDERATION_MANAGEMENT
 
-// $Id: FederationManagement.hh,v 3.21 2007/12/17 16:01:24 rousse Exp $
+// $Id: FederationManagement.hh,v 3.22 2008/04/29 13:11:14 erk Exp $

Index: FederationManagement.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/FederationManagement.cc,v
retrieving revision 3.58
retrieving revision 3.59
diff -u -b -r3.58 -r3.59
--- FederationManagement.cc     28 Apr 2008 17:20:19 -0000      3.58
+++ FederationManagement.cc     29 Apr 2008 13:11:15 -0000      3.59
@@ -18,7 +18,7 @@
 // along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: FederationManagement.cc,v 3.58 2008/04/28 17:20:19 erk Exp $
+// $Id: FederationManagement.cc,v 3.59 2008/04/29 13:11:15 erk Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -67,9 +67,9 @@
     //_est_createur_federation = false ;
     _est_membre_federation = false ;
 
-    _nom_federation = NULL ;
-    _nom_federe[0] = 0 ;
-    _FEDid = NULL ;
+    _nom_federation = "";
+    _nom_federe     = "";
+    _FEDid          = NULL;
     G.Out(pdGendoc,"exit  FederationManagement::FederationManagement");
 }
 
@@ -100,7 +100,6 @@
         cout << "RTIA: Federation destroyed" << endl ;
     //}
 
-    delete _nom_federation ;
     delete _FEDid ;
     G.Out(pdGendoc,"exit  ~FederationManagement");
 }
@@ -146,8 +145,7 @@
 
         if (reponse->exception == e_NO_EXCEPTION)
             {
-            _nom_federation = new char[strlen(theName)+1] ;
-            strcpy(_nom_federation, theName);
+            _nom_federation = std::string(theName);            
             _numero_federation = reponse->federation ;
             D.Out(pdInit, "est createur");
             }
@@ -221,7 +219,7 @@
                           federate));
 
         if (reponse->exception == e_NO_EXCEPTION) {
-            _nom_federation    = NULL ;
+            _nom_federation    = "" ;
             _numero_federation = 0 ;
             _fin_execution     = true ;
             // Now, remove temporary file (if not yet done)
@@ -390,9 +388,8 @@
         // If OK, regulators number is inside the answer.
         // Then we except a NULL message from each.
         if (reponse->exception == e_NO_EXCEPTION) {
-            _nom_federation = new char[strlen(Federation)+1] ;
-            strcpy(_nom_federation, Federation);
-            strcpy(_nom_federe, Federate);
+            _nom_federation = std::string(Federation);            
+            _nom_federe =  std::string(Federate);
             _numero_federation = reponse->federation ;
             federate = reponse->federate ;
             tm->setFederate(reponse->federate);




reply via email to

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