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.

How to transfer app and data from old iPhone to new iPhone for model IOS17 and IOS18 above.

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