Fix dangling pointer. Likely cause for crashes; could be that mingw64 crash.