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

Clearcase check in/uncheck out all the checked out files script

MSSQL GROUP_CONCAT

Duplicating a local copy of project from TFS and making web software client factory to work