Looks like a memory leak, the `old_locale` should be `free()`d. See http://www.gnu.org/software/libc/manual/html_node/Setting-the-Locale.html for an example of temporary locale switching.