Re: Memory Leaks - Can you help me find them in ths snippet
"firstname.lastname@example.org" <email@example.com> wrote:
Thank you, I will correct that additional leak if i>0
The reason I am using these datatypes is because I am utilizing this
3rd party library method:
extern LONG SDEAPI SE_stream_update_row (SE_STREAM stream,
const ACHAR *table,
const ACHAR **columns);
So I figured I had to use the char data type.
Sorry, I thought you were using each column individually. i.e., I
thought the API was asking for char* and was being called multiple
times, not char** and called once.
However, I still recommend you use vectors rather than allocating the
memory yourself and hoping for the best.
Something like this would do nicely:
vector< vector< char > >
block( lColumnCount, SE_QUALIFIED_COLUMN_LEN );
for ( int i = 0; i < block.size(); ++i )
strcpy( &block[i].front(), CStringColumnName[i] );
vector< char* > columns( block.size() );
for ( int i = 0; i != block.size(); ++i )
columns[i] = &block[i].front();
SE_stream_update_row( /* other params */, &columns );