fix invalid free of duplocale object when malloc has been replaced