You really shouldn't have the declaration for dummy in main.h, it should be declared in main and then put extern cdspfile dummy; in main.h.
I *really* don't like dummy.
Your memory is still being taken up by realdsp, which is never used (that I can see).
The crash may come from the fact that the DSPs will not necessarily be at the end of the image file. Thus the last one you extract will potentially take gigabytes of memory, which could fail.