[network-manager-applet: 1/6] libnma: fix memory leak in nma_utils_menu_to_secret_flags()



commit cd3f785d55bd6795de484735344a9b56cb8e2b4b
Author: Beniamino Galvani <bgalvani redhat com>
Date:   Thu Dec 22 17:32:34 2016 +0100

    libnma: fix memory leak in nma_utils_menu_to_secret_flags()

 src/libnma/nma-ui-utils.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/libnma/nma-ui-utils.c b/src/libnma/nma-ui-utils.c
index 7649ee5..99e2e97 100644
--- a/src/libnma/nma-ui-utils.c
+++ b/src/libnma/nma-ui-utils.c
@@ -339,17 +339,18 @@ nma_utils_menu_to_secret_flags (GtkWidget *passwd_entry)
        /* Translate password popup menu to secret flags */
        if (menu) {
                MenuItem idx = 0;
-               GList *list;
+               gs_free_list GList *list = NULL;
                int i, length;
 
                list = gtk_container_get_children (GTK_CONTAINER (menu));
+               iter = list;
                length = g_list_length (list);
                for (i = 0; i < length; i++) {
-                       if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (list->data))) {
+                       if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (iter->data))) {
                                idx =  (MenuItem) i;
                                break;
                        }
-                       list = g_list_next (list);
+                       iter = g_list_next (iter);
                }
 
                flags = menu_item_to_secret_flags (idx);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]