PIEHP0002 error resulting with memory requested but never freed