You're only malloc'ing enough space for a pointer with this line
bitmap = (DIB_t*)malloc(sizeof(bitmap));
what you really need is
bitmap = (DIB_t*)malloc(sizeof(DIB_t));
Also, as mrbatch noted, you're using a 16 bit compiler and so attempting to read 4 bytes of data into 2 byte int
variables. Make sure the sizeof() your types matches what you're reading, e.g. a long int
So - in general - you are corrupting both your stack and your heap by writing more data than you should, and you can expect your program to behave very oddly :)