C++ Heap Corruption example

class A {

A(int i)
{
text = (char *)malloc(sizeof (char *)) ;
}

A()
{
text = (char *)malloc(sizeof (char *)) ;
}

virtual ~A()
{
if(text != 0)
{
free(text);
text = 0;
}
}

};


void main()
{
A a;
a = A(123);
}

Comments

Popular posts from this blog

Outlook : "operation failed, object could not be found. " when trying to close a PST.

Troubleshooting Outlook Express (IMAP, POP3, HTTP, NEWS) with the log file

MSSQL GROUP_CONCAT