[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54031] trunk/blender/source/blender/ python/intern/bpy_app_translations.c: Fix own stupid memory leak in new py i18n code ( forgot to free temp keys when searching messages in GHash cache!).

Bastien Montagne montagne29 at wanadoo.fr
Wed Jan 23 08:59:12 CET 2013


Revision: 54031
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54031
Author:   mont29
Date:     2013-01-23 07:59:07 +0000 (Wed, 23 Jan 2013)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/python/intern/bpy_app_translations.c

Modified: trunk/blender/source/blender/python/intern/bpy_app_translations.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_app_translations.c	2013-01-23 07:52:31 UTC (rev 54030)
+++ trunk/blender/source/blender/python/intern/bpy_app_translations.c	2013-01-23 07:59:07 UTC (rev 54031)
@@ -73,7 +73,7 @@
 
 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 @@
 
 	tmp = BLI_ghash_lookup(_translations_cache, key);
 
+	_ghashutil_keyfree((void *)key);
+
 	if (tmp)
 		return tmp;
 	return msgid;




More information about the Bf-blender-cvs mailing list