From bb14b390e552d30bf878bf2f4872dcf90e3d05f4 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 23 Jan 2013 07:59:07 +0000 Subject: Fix own stupid memory leak in new py i18n code (forgot to free temp keys when searching messages in GHash cache!). Thanks to PerfectionCat for finding this. --- source/blender/python/intern/bpy_app_translations.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source/blender/python/intern/bpy_app_translations.c') diff --git a/source/blender/python/intern/bpy_app_translations.c b/source/blender/python/intern/bpy_app_translations.c index 13ca90c4e34..dffa8f20fa3 100644 --- a/source/blender/python/intern/bpy_app_translations.c +++ b/source/blender/python/intern/bpy_app_translations.c @@ -73,7 +73,7 @@ typedef struct GHashKey { static GHashKey *_ghashutil_keyalloc(const void *msgctxt, const void *msgid) { - GHashKey *key = MEM_mallocN(sizeof(GHashKey), "GHashPair"); + GHashKey *key = MEM_mallocN(sizeof(GHashKey), "Py i18n GHashKey"); key->msgctxt = BLI_strdup(msgctxt ? msgctxt : BLF_I18NCONTEXT_DEFAULT_BPY_INTERN); key->msgid = BLI_strdup(msgid); return key; @@ -286,6 +286,8 @@ const char *BPY_app_translations_py_pgettext(const char *msgctxt, const char *ms tmp = BLI_ghash_lookup(_translations_cache, key); + _ghashutil_keyfree((void *)key); + if (tmp) return tmp; return msgid; -- cgit v1.2.3