fix longstanding leak in module config dialog
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Thu, 30 Aug 2012 12:21:30 +0000 (12:21 +0000)
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Thu, 30 Aug 2012 12:21:30 +0000 (12:21 +0000)
SVN revision: 75878

src/bin/e_int_config_modules.c

index dd5bb9a..c778333 100644 (file)
@@ -72,6 +72,7 @@ static void         _module_end_state_apply(CFModule *cfm);
 
 static void         _toolbar_select_cb(void *data, void *data2);
 
+static CFType      *_cftype_find(E_Config_Dialog_Data *cfdata, const char *key, const char *name, const char *icon);
 static CFType      *_cftype_new(const char *key, const char *name, const char *icon);
 static void         _load_modules(const char *dir, Eina_Hash *types_hash);
 static Eina_Bool    _types_list_create_foreach_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata);
@@ -209,7 +210,7 @@ _fill_cat_list(E_Config_Dialog_Data *cfdata)
 
    for (itr = _types; itr->key_len > 0; itr++)
      {
-        cft = _cftype_new(itr->key, _(itr->name), itr->icon);
+        cft = _cftype_find(cfdata, itr->key, _(itr->name), itr->icon);
         icon = e_icon_add(cfdata->evas);
         if (icon)
           {
@@ -371,6 +372,17 @@ _module_end_state_apply(CFModule *cfm)
 }
 
 static CFType *
+_cftype_find(E_Config_Dialog_Data *cfdata, const char *key, const char *name, const char *icon)
+{
+   CFType *cft;
+   Eina_List *l;
+
+   EINA_LIST_FOREACH(cfdata->types, l, cft)
+     if ((!strcmp(cft->key, key)) && (!strcmp(cft->name, name)) && (!strcmp(cft->icon, icon))) return cft;
+   return NULL;
+}
+
+static CFType *
 _cftype_new(const char *key, const char *name, const char *icon)
 {
    CFType *cft = E_NEW(CFType, 1);