-
RW CString - understanding
Header File
void* m_buffer;
Constructor
m_buffer = (void *)new RWCString; //member variable intitialized in constructor
Destructor
if (m_buffer)
{
RWCString *pBuffer = (RWCString *)(m_buffer)
delete pStatementBuffer;
}
ClearData()
{
RWCString *pBuffer = (RWCString*)m_buffer;
*pBuffer = "";
}
void
AssignData(LPCTSTR format, ...)
{
char buffer[2048];
char *buffer_ptr = buffer;
va_list argList;
//used sprintf to create format and arglist to form sqlcommand and store in buffer_ptr
for e.g. sprintf(buffer_ptr, format, argList);
RWCString *pBuffer = (RWCString *)m_buffer;
pBuffer->append(buffer);
}
Being first time user of Roguewave and working on some already written code.
I am having hard time to understand if this code is causing any memory leak.
Because AssignData can be called 4-5 times in sequence, that means it will keep appending more buffer.
Then function does some other execution and calls ClearData.
Then again few AssignData calls and clearData.
Does clearData is taking care of deallocating memory.
Any help is appreciated!
Last edited by sVirgo5; 09-08-2012 at 02:52 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules