X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=appli%2Fbash%2FcpPlugins_CreateInstances.cxx;h=99eb60ef6e9a249ac11aac6d4351e73a62bb2f70;hb=b67cad9ff3c38b4e99ac48a4852e9e94cb879c6a;hp=a09b822e1ef5bb909e8ad2997d800736e6d7f7a8;hpb=e29096b7c37e89da4cda28bde9102cdb9ff159ea;p=cpPlugins.git diff --git a/appli/bash/cpPlugins_CreateInstances.cxx b/appli/bash/cpPlugins_CreateInstances.cxx index a09b822..99eb60e 100644 --- a/appli/bash/cpPlugins_CreateInstances.cxx +++ b/appli/bash/cpPlugins_CreateInstances.cxx @@ -199,8 +199,9 @@ int main( int argc, char* argv[] ) // Write instantiations for( auto combIt = combs.begin( ); combIt != combs.end( ); ++combIt ) { - char* buffer = new char[ combIt->size( ) ]; + char* buffer = new char[ combIt->size( ) + 1 ]; std::strcpy( buffer, combIt->c_str( ) ); + buffer[ combIt->size( ) ] = '\0'; char* tok = std::strtok( buffer, "#" ); std::map< std::string, std::string > real_instance; for( auto lIt = li.begin( ); lIt != li.end( ); ++lIt ) @@ -209,13 +210,13 @@ int main( int argc, char* argv[] ) tok = std::strtok( NULL, "#" ); } // rof + delete buffer; std::string real_name = name; auto riIt = real_instance.begin( ); for( ; riIt != real_instance.end( ); ++riIt ) Replace( real_name, riIt->first, riIt->second ); all_real_classes.push_back( real_name ); - delete buffer; } // rof }