Plug a memory and fd leak if keeptemps is enabled