]> Creatis software - cpPlugins.git/blobdiff - appli/bash/cpPlugins_CreateInstances.cxx
PolyLineParametricPath basic visualization and plugin added.
[cpPlugins.git] / appli / bash / cpPlugins_CreateInstances.cxx
index a09b822e1ef5bb909e8ad2997d800736e6d7f7a8..99eb60ef6e9a249ac11aac6d4351e73a62bb2f70 100644 (file)
@@ -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
     }