Addressed an Xcode alert of using mktemp

Alert quote from Xcode:
"Call to function mktemp is insecure as it always creates or uses
insecure temporary file. Use mkstemp instead"
Fixed a memory leak
Merge pull request #88 from smokyonion/AddressMemoryLeaks

Fixed a memory leak
Merge pull request #87 from smokyonion/UsingMkstemp

Addressed an Xcode alert of using mktemp