Question about memory/allocation/pointers
I have a program that looks something like this:
Code:
unsigned char* Data;
unsigned char* TempData;
TempData=new unsigned char[256];
if(TempData!=NULL)
{
Data=&TempData;
TempData=NULL;
}
if(Data!=NULL)
{
delete[] Data;
}
It uses a temporary pointer to allocate memory, and if successful makes Data the pointer to this memory.
I get a suspicious pointer conversation warning when compiling. Is there something wrong with this code? It seems to work fine when running the program.