DecodeImageMem was leaking memory because the mat header wasn't being deallocated.