c - Weird crash with pointers / malloc() on if check of the pointer value -
I have some very strange accident here, Ive got it first, but I thought I had it = announcements:
#include & lt; Stdlib.h & gt; ... glutton * tx = null; Integer TEX_MEMSIZE = size (glut) * 1024 * 1024; ... some zero (1) () {... TEX = (glutton *) Molk (TEX_MEMSIZE); ...} some 2 zeros () {... // This line is going fine. If (tex! = Null) {// crash on this line code / / do not move anything after the line above Free (TEX); } // ... and even since it crashed ... ...}
It crashes on my laptop / Vista, but my desktop Not on computer / winXP
When I remove it, check and free (), it does not crash anymore.
I do not take it, what's wrong? What could be the cause of this? I can only mis-predefined arrays for the reason of some inconsistency errors, I believe there are no such bad eras in my code, so I am waiting for more ideas. (And because checking of 20k lines of code can also be quite slow)
Edit: Now I have seen that it will not crash before free () but after that I started thinking of some of my predefined array problems ... because the crash situation is changing. (Or I just have dementia).
Edit 2: Fixed, there were two free () calls, before and after malloc ()> _> I was feeling so stupid now
How is TEX_MEMSIZE defined?
It should be something like:
#define NUM_ENTRIES 50 # Define TEX_MEMSIZE NUM_ENTRIES * Size (GLuint)
Comments
Post a Comment