strdup locale to avoid use-after-free

To be sure you can use the returned string encoding the currently selected locale at a later time, you must make a copy of the string. It is not guaranteed that the returned pointer remains valid over time.
From https://www.gnu.org/software/libc/manual/html_node/Setting-the-Locale.html
Merge pull request #321 from LebedevRI/AddressSanitizer

strdup locale to avoid use-after-free -  It is not guaranteed that the pointer returned by `locale` remains valid over time.