diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2013-01-23 11:59:07 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2013-01-23 11:59:07 +0400 |
commit | bb14b390e552d30bf878bf2f4872dcf90e3d05f4 (patch) | |
tree | b5e7e2c7aeb4e31d28829a94e2822936c7477402 | |
parent | fd35d42bf4c29ee0101e3a8714cb835c0cd736f5 (diff) |
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.
-rw-r--r-- | source/blender/python/intern/bpy_app_translations.c | 4 |
1 files changed, 3 insertions, 1 deletions
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; |