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.
This commit is contained in:
2013-01-23 07:59:07 +00:00
parent fd35d42bf4
commit bb14b390e5

View File

@@ -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;