0xc0000374 is STATUS_HEAP_CORRUPTION hopefully that gives some clue in what parts of your code you should focus on.