summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2021-04-24 17:17:07 +0200
committerDave Andreoli <dave@gurumeditation.it>2021-04-24 17:17:07 +0200
commit69b258794ad2e6d7a8d2f871082c11701807a2bc (patch)
tree4c1b2b21baaac7ce109928818678c99e2a805b77
parentab180f1199314435c11e83283eadec50b202302f (diff)
don't leak strings in menu
-rw-r--r--src/e_mod_places.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/e_mod_places.c b/src/e_mod_places.c
index 5fca5a7..2dcc227 100644
--- a/src/e_mod_places.c
+++ b/src/e_mod_places.c
@@ -882,6 +882,8 @@ _places_header_activated_cb(void *data, Evas_Object *o, const char *emission, co
882 882
883 883
884/* E17 menu augmentation */ 884/* E17 menu augmentation */
885static Eina_List *_menu_strings = NULL;
886
885void 887void
886_places_menu_folder_cb(void *data, E_Menu *m, E_Menu_Item *mi) 888_places_menu_folder_cb(void *data, E_Menu *m, E_Menu_Item *mi)
887{ 889{
@@ -909,11 +911,15 @@ _places_bookmarks_parse(E_Menu *em)
909{ 911{
910 char line[PATH_MAX]; 912 char line[PATH_MAX];
911 char buf[PATH_MAX]; 913 char buf[PATH_MAX];
914 const char *s;
912 E_Menu_Item *mi; 915 E_Menu_Item *mi;
913 Efreet_Uri *uri; 916 Efreet_Uri *uri;
914 char *alias; 917 char *alias;
915 FILE* fp; 918 FILE* fp;
916 919
920 EINA_LIST_FREE(_menu_strings, s)
921 eina_stringshare_del(s);
922
917 snprintf(buf, sizeof(buf), "%s/gtk-3.0/bookmarks", efreet_config_home_get()); 923 snprintf(buf, sizeof(buf), "%s/gtk-3.0/bookmarks", efreet_config_home_get());
918 fp = fopen(buf, "r"); 924 fp = fopen(buf, "r");
919 if (!fp) 925 if (!fp)
@@ -940,8 +946,9 @@ _places_bookmarks_parse(E_Menu *em)
940 e_menu_item_label_set(mi, alias ? alias : 946 e_menu_item_label_set(mi, alias ? alias :
941 ecore_file_file_get(uri->path)); 947 ecore_file_file_get(uri->path));
942 e_util_menu_item_theme_icon_set(mi, "user-bookmarks"); 948 e_util_menu_item_theme_icon_set(mi, "user-bookmarks");
943 e_menu_item_callback_set(mi, _places_menu_folder_cb, 949 s = eina_stringshare_add(uri->path);
944 strdup(uri->path)); //TODO free somewhere 950 e_menu_item_callback_set(mi, _places_menu_folder_cb, s);
951 _menu_strings = eina_list_append(_menu_strings, s);
945 } 952 }
946 if (uri) efreet_uri_free(uri); 953 if (uri) efreet_uri_free(uri);
947 } 954 }