The analysis is absolutely correct - thanks a lot for catching this! I added a check whether mktemp returned successfully now.