[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[certi-cvs] certi libCERTI/ObjectClass.cc libCERTI/Exceptio...
From: |
certi-cvs |
Subject: |
[certi-cvs] certi libCERTI/ObjectClass.cc libCERTI/Exceptio... |
Date: |
Tue, 29 Apr 2008 08:57:48 +0000 |
CVSROOT: /sources/certi
Module name: certi
Changes by: Eric NOULARD <erk> 08/04/29 08:57:48
Modified files:
libCERTI : ObjectClass.cc Exception.cc
RTIG : Federation.hh Federation.cc
Log message:
Fix some more small mem leak
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/ObjectClass.cc?cvsroot=certi&r1=3.42&r2=3.43
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/Exception.cc?cvsroot=certi&r1=3.11&r2=3.12
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/Federation.hh?cvsroot=certi&r1=3.45&r2=3.46
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/Federation.cc?cvsroot=certi&r1=3.84&r2=3.85
Patches:
Index: libCERTI/ObjectClass.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/ObjectClass.cc,v
retrieving revision 3.42
retrieving revision 3.43
diff -u -b -r3.42 -r3.43
--- libCERTI/ObjectClass.cc 26 Apr 2008 14:59:40 -0000 3.42
+++ libCERTI/ObjectClass.cc 29 Apr 2008 08:57:48 -0000 3.43
@@ -19,7 +19,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: ObjectClass.cc,v 3.42 2008/04/26 14:59:40 erk Exp $
+// $Id: ObjectClass.cc,v 3.43 2008/04/29 08:57:48 erk Exp $
// ----------------------------------------------------------------------------
#include "Object.hh"
@@ -696,7 +696,7 @@
ObjectClassBroadcastList *
ObjectClass::registerObjectInstance(FederateHandle the_federate,
Object *the_object,
- ObjectClassHandle)
+ ObjectClassHandle classHandle)
throw (ObjectClassNotPublished,
ObjectAlreadyRegistered,
RTIinternalError)
@@ -704,7 +704,7 @@
// Pre-conditions checking
if (isInstanceInClass(the_object->getHandle())) {
D.Out(pdExcept, "exception : ObjectAlreadyRegistered.");
- throw ObjectAlreadyRegistered("");
+ throw ObjectAlreadyRegistered(the_object->getName().c_str());
}
// This condition is only to be checked on the RTIG
@@ -1806,4 +1806,4 @@
} // namespace certi
-// $Id: ObjectClass.cc,v 3.42 2008/04/26 14:59:40 erk Exp $
+// $Id: ObjectClass.cc,v 3.43 2008/04/29 08:57:48 erk Exp $
Index: libCERTI/Exception.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/Exception.cc,v
retrieving revision 3.11
retrieving revision 3.12
diff -u -b -r3.11 -r3.12
--- libCERTI/Exception.cc 29 Apr 2008 07:50:22 -0000 3.11
+++ libCERTI/Exception.cc 29 Apr 2008 08:57:48 -0000 3.12
@@ -19,7 +19,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: Exception.cc,v 3.11 2008/04/29 07:50:22 rousse Exp $
+// $Id: Exception.cc,v 3.12 2008/04/29 08:57:48 erk Exp $
// ----------------------------------------------------------------------------
#include <assert.h>
@@ -250,6 +250,9 @@
RTI::Exception::~Exception()
{
+ if (NULL!=_reason) {
+ free(_reason);
+ }
}
RTI::Exception::Exception(const char *reason)
Index: RTIG/Federation.hh
===================================================================
RCS file: /sources/certi/certi/RTIG/Federation.hh,v
retrieving revision 3.45
retrieving revision 3.46
diff -u -b -r3.45 -r3.46
--- RTIG/Federation.hh 28 Feb 2008 14:47:58 -0000 3.45
+++ RTIG/Federation.hh 29 Apr 2008 08:57:48 -0000 3.46
@@ -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: Federation.hh,v 3.45 2008/02/28 14:47:58 rousse Exp $
+// $Id: Federation.hh,v 3.46 2008/04/29 08:57:48 erk Exp $
// ----------------------------------------------------------------------------
#ifndef _CERTI_RTIG_FEDERATION_HH
@@ -55,8 +55,8 @@
// ATTRIBUTES
--------------------------------------------------------------
private:
Handle handle ;
- char *name ;
- char *FEDid ;
+ std::string name ;
+ std::string FEDid ;
//! Labels and Tags not on synchronization.
std::map<const char *, const char *> synchronizationLabels ;
@@ -594,4 +594,4 @@
#endif // _CERTI_RTIG_FEDERATION_HH
-// $Id: Federation.hh,v 3.45 2008/02/28 14:47:58 rousse Exp $
+// $Id: Federation.hh,v 3.46 2008/04/29 08:57:48 erk Exp $
Index: RTIG/Federation.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/Federation.cc,v
retrieving revision 3.84
retrieving revision 3.85
diff -u -b -r3.84 -r3.85
--- RTIG/Federation.cc 29 Apr 2008 08:33:04 -0000 3.84
+++ RTIG/Federation.cc 29 Apr 2008 08:57:48 -0000 3.85
@@ -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: Federation.cc,v 3.84 2008/04/29 08:33:04 erk Exp $
+// $Id: Federation.cc,v 3.85 2008/04/29 08:57:48 erk Exp $
// ----------------------------------------------------------------------------
#include <config.h>
@@ -145,13 +145,11 @@
if ((federation_name == NULL) || (federation_handle == 0))
throw RTIinternalError("Null init parameter in Federation creation.");
- name = strdup(federation_name);
+ name = std::string(federation_name);
// Default Attribute values
- handle = federation_handle ;
-
- FEDid = new char[strlen(FEDid_name)+1] ;
- strcpy(FEDid,FEDid_name);
+ handle = federation_handle;
+ FEDid = std::string(FEDid_name);
D.Out(pdInit, "New Federation created with Handle %d, now reading FOM.",
handle);
@@ -164,7 +162,6 @@
cout << "New federation: " << name << endl ;
-
// We should try to open FOM file from different
// predefined places:
//
@@ -175,7 +172,7 @@
// 3 - default (unix) installation place plus FEDid_name
// "/usr/local/share/federation/" + FEDid_name
//
- string filename = string(FEDid) ;
+ string filename = FEDid;
bool filefound = false;
cout << "Looking for FOM file... " << endl ;
@@ -223,11 +220,10 @@
}
// now really assign FEDid
- free(FEDid);
- FEDid = strdup(filename.c_str());
+ FEDid = filename;
// Try to open to verify if file exists
- std::ifstream fedTry(FEDid);
+ std::ifstream fedTry(FEDid.c_str());
if (!fedTry.is_open())
{
cout << "... failed : ";
@@ -347,10 +343,7 @@
// clear();
// Free local allocations
- free(name);
- delete[] FEDid;
delete root ;
-
delete server ;
#ifdef FEDERATION_USES_MULTICAST
@@ -389,7 +382,7 @@
const char *
Federation::getName() const
{
- return name ;
+ return name.c_str() ;
}
// ----------------------------------------------------------------------------
@@ -405,8 +398,7 @@
const char *
Federation::getFEDid() const
{
- assert(FEDid != NULL );
- return FEDid ;
+ return FEDid.c_str() ;
}
// ----------------------------------------------------------------------------
@@ -2158,7 +2150,7 @@
return false ;
}
- if (strcmp(name, XmlParser::CleanXmlGetProp(cur,(const xmlChar*)"name"))
!= 0) {
+ if (strcmp(name.c_str(), XmlParser::CleanXmlGetProp(cur,(const
xmlChar*)"name")) != 0) {
cerr << "Wrong federation name" << endl ;
}
@@ -2210,7 +2202,7 @@
xmlNodePtr federation ;
federation = xmlNewChild(doc->children, NULL, NODE_FEDERATION, NULL);
- xmlSetProp(federation, (const xmlChar *) "name", (const xmlChar *) name);
+ xmlSetProp(federation, (const xmlChar *) "name", (const xmlChar *)
name.c_str());
char t[10] ;
sprintf(t, "%ld", handle);
@@ -2281,5 +2273,5 @@
}} // namespace certi/rtig
-// $Id: Federation.cc,v 3.84 2008/04/29 08:33:04 erk Exp $
+// $Id: Federation.cc,v 3.85 2008/04/29 08:57:48 erk Exp $
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [certi-cvs] certi libCERTI/ObjectClass.cc libCERTI/Exceptio...,
certi-cvs <=