There are a number of code paths in CmisClient::execute( ) that look like they will leak the session object, for example:
else if ( "repo-infos" == command )
{
libcmis::Session* session = getSession( );
libcmis::RepositoryPtr repo = session->getRepository( );
if ( repo )
// ...
else
throw CommandException( "Please select a repository" );
delete session;
}
If an exception is thrown the session isn't deleted.
Similarly in the next block:
else if ( "type-by-id" == command )
{
libcmis::Session* session = getSession( );
// Get the ids of the types to fetch
if ( m_vm.count( "args" ) == 0 )
throw CommandException( "Please provide the node ids to show as command args" );
// ...
delete session;
}
If the exception is thrown the session isn't deleted.
And the next block. And the next block. And so on.
If there is some reason that code isn't leaky then it should be commented clearly to say why not deleting the sessions is safe.
But if there are leaks then there is no excuse for it, idiomatic C++ does not have naked delete statements like that. Using boost::scoped_ptr<libcmis::Session> would make the code easier to understand and safer.
Pushed to master. Thanks for the patch