Original Post
This code crashes when I run it but I can''t find anything wrong. If I remove the free(Data); line or the loops that fills the array it doesn''t crash.
please help me.
USHORT *Data; int iWidth = 50; int iHeight = 50; int newSize = iWidth*iHeight; Data = (USHORT*)malloc(newSize); for(y=0;y<iHeight;y++) for(int x=0;x<iWidth;x++) Data = (USHORT*)5000; if(Data) free(Data); Data = NULL;