diff options
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/intern/bpy_app_translations.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/source/blender/python/intern/bpy_app_translations.c b/source/blender/python/intern/bpy_app_translations.c index 6d0161c2047..2135abdd589 100644 --- a/source/blender/python/intern/bpy_app_translations.c +++ b/source/blender/python/intern/bpy_app_translations.c @@ -241,12 +241,9 @@ static void _build_translations_cache(PyObject *py_messages, const char *locale) } /* Clean up! */ - if (language) - MEM_freeN(language); - if (language_country) - MEM_freeN(language_country); - if (language_variant) - MEM_freeN(language_variant); + MEM_SAFE_FREE(language); + MEM_SAFE_FREE(language_country); + MEM_SAFE_FREE(language_variant); } const char *BPY_app_translations_py_pgettext(const char *msgctxt, const char *msgid) @@ -631,6 +628,7 @@ PyDoc_STRVAR(app_translations_locale_explode_doc, ); static PyObject *app_translations_locale_explode(BlenderAppTranslations *UNUSED(self), PyObject *args, PyObject *kw) { + PyObject *ret_tuple; static const char *kwlist[] = {"locale", NULL}; const char *locale; char *language, *country, *variant, *language_country, *language_variant; @@ -641,7 +639,15 @@ static PyObject *app_translations_locale_explode(BlenderAppTranslations *UNUSED( BLF_locale_explode(locale, &language, &country, &variant, &language_country, &language_variant); - return Py_BuildValue("sssss", language, country, variant, language_country, language_variant); + ret_tuple = Py_BuildValue("sssss", language, country, variant, language_country, language_variant); + + MEM_SAFE_FREE(language); + MEM_SAFE_FREE(country); + MEM_SAFE_FREE(variant); + MEM_SAFE_FREE(language_country); + MEM_SAFE_FREE(language_variant); + + return ret_tuple; } static PyMethodDef app_translations_methods[] = { |