The memory seems to be deallocated twice? I am quite sure that you have not chosen the multi-threaded version of the C libraries. This is a problem of Mickeysoft who sell a multi-threaded system which isn't. Ciao, Dscho