Fix two small memory leaks in addressbook code
authorAndrej Kacian <ticho@claws-mail.org>
Wed, 13 Mar 2019 19:54:20 +0000 (20:54 +0100)
committerAndrej Kacian <ticho@claws-mail.org>
Wed, 13 Mar 2019 19:54:20 +0000 (20:54 +0100)
In each case, the GList structure itself was not
being freed.

src/addrbook.c
src/editgroup.c

index 8087996..296af5d 100644 (file)
@@ -1606,7 +1606,7 @@ static void addrbook_build_avail_email_vis(gpointer key, gpointer value,
 /**
  * Return link list of available email items that have not already been linked
  * to groups. Note that the list contains references to items and should be
- * <code>g_free()</code> when done. Do <b>*NOT*</b> attempt to used the
+ * <code>g_list_free()</code> when done. Do <b>*NOT*</b> attempt to used the
  * <code>addrbook_free_xxx()<code> functions... this will destroy the
  * addressbook data!
  *
@@ -1672,8 +1672,7 @@ void addrbook_update_group_list(AddressBookFile *book, ItemGroup *group,
        /* Remember old list */
        oldData = group->listEMail;
        group->listEMail = listEMail;
-       mgu_clear_list(oldData);
-       oldData = NULL;
+       g_list_free(oldData);
 }
 
 /**
index 22f16a8..6571296 100644 (file)
@@ -506,8 +506,7 @@ ItemGroup *addressbook_edit_group( AddressBookFile *abf, ItemFolder *parent, Ite
 
        listEMail = addrbook_get_available_email_list( abf, group );
        edit_group_load_clist( groupeditdlg.clist_avail, listEMail );
-       mgu_clear_list( listEMail );
-       listEMail = NULL;
+       g_list_free( listEMail );
        gtk_cmclist_select_row( groupeditdlg.clist_group, 0, 0 );
        gtk_cmclist_select_row( groupeditdlg.clist_avail, 0, 0 );