Hi all,
I have a piece of code like this
constructor:
IPCClientDataTr ansfer::IPCClie ntDataTransfer (RWCString serviceName) :Valid(FALSE)
{
NSTcpProfile tcpProfile;
int clientPriority = 1;
tcpProfile.Bloc kingOnConnect = TRUE;
tcpProfile.Bloc king = TRUE;
strcpy(tcpProfi le.ServiceName, serviceName);
strcpy(tcpProfi le.TcpHostName, "localhost" );
this -> PClient = new IPCAMAClient (&tcpProfile, clientPriority) ;
// Check to see if the IPCAMAClient is a valid object
if (!this -> PClient -> isValid())
{
// The object is invalid, the connection was not established
delete this -> PClient;
this -> PClient = NULL;
}
else
{
// The Object is valid
this -> Valid = TRUE;
}
destructor:
IPCClientDataTr ansfer::~IPCCli entDataTransfer ()
{
if (this -> PClient)
delete this -> PClient;
}
the destructor is not virtual.does this means that there will be memory leak?
I have a piece of code like this
constructor:
IPCClientDataTr ansfer::IPCClie ntDataTransfer (RWCString serviceName) :Valid(FALSE)
{
NSTcpProfile tcpProfile;
int clientPriority = 1;
tcpProfile.Bloc kingOnConnect = TRUE;
tcpProfile.Bloc king = TRUE;
strcpy(tcpProfi le.ServiceName, serviceName);
strcpy(tcpProfi le.TcpHostName, "localhost" );
this -> PClient = new IPCAMAClient (&tcpProfile, clientPriority) ;
// Check to see if the IPCAMAClient is a valid object
if (!this -> PClient -> isValid())
{
// The object is invalid, the connection was not established
delete this -> PClient;
this -> PClient = NULL;
}
else
{
// The Object is valid
this -> Valid = TRUE;
}
destructor:
IPCClientDataTr ansfer::~IPCCli entDataTransfer ()
{
if (this -> PClient)
delete this -> PClient;
}
the destructor is not virtual.does this means that there will be memory leak?
Comment