Don't read free'd memory when switching locales.

Apparently setlocale(..., NULL) returns an internal buffer,
and setlocale(..., "C") frees this buffer.

Therefore make a copy of setlocale(..., NULL)'s result
and free it later.

Bug discovered by @dbussink using Valgrind.