Secondly, and most importantly, you're freeing the data pointer at the end of the LoadTexture function so the header's data pointer will then point to freed memory.
, i knew it was something stupid ops:
I tried to do that but nothing has changed, i still get a blank image