I'm working on a simple library to load data from .3ds files. I was working on it, and everything was working almost perfectly, when I realized that I should have been reading four bytes for each item in facelist[] and I was only reading two (code attached). I simply modified the code to read the four bytes instead of two, and suddenly the program started crashing every time I called my load3ds() function. I've been scouring this code, and I tried compiling it on a different system just to see if something about my computer was screwing it up to no avail. The odd thing is, I've changed the code back to its original state and the problem remains. Is there something someone else can see that I'm missing?

(I was trying to use malloc to dynamically create just enough space for my lists of faces and vertices, as you can see, but for some reason that was also not working for me. The array sizes should be sufficient, the file I'm testing with only has 20 vertices and 12 faces.)

You need obj3ds* outobject = malloc ( sizeof *obj3ds );