[evolution-data-server/gnome-42] Fix few memory leaks discovered by Coverity scan



commit c7142d1d61c5a5bd924c2788701de2765f38916f
Author: Milan Crha <mcrha redhat com>
Date:   Mon May 9 08:23:03 2022 +0200

    Fix few memory leaks discovered by Coverity scan

 src/addressbook/backends/ldap/e-book-backend-ldap.c | 10 ++++++++--
 src/camel/providers/nntp/camel-nntp-store.c         |  3 +++
 2 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/addressbook/backends/ldap/e-book-backend-ldap.c 
b/src/addressbook/backends/ldap/e-book-backend-ldap.c
index 47383b315..1c8336362 100644
--- a/src/addressbook/backends/ldap/e-book-backend-ldap.c
+++ b/src/addressbook/backends/ldap/e-book-backend-ldap.c
@@ -2841,7 +2841,7 @@ homephone_compare (EContact *contact1,
                   const gchar *ldap_attr)
 {
        gint phone_ids[2] = { E_CONTACT_PHONE_HOME, E_CONTACT_PHONE_HOME_2 };
-       const gchar *phone1, *phone2;
+       gchar *phone1, *phone2;
        gint i;
 
        for (i = 0; i < 2; i++) {
@@ -2854,6 +2854,9 @@ homephone_compare (EContact *contact1,
                else
                        equal = (!!phone1 == !!phone2);
 
+               g_free (phone1);
+               g_free (phone2);
+
                if (!equal)
                        return equal;
        }
@@ -2914,7 +2917,7 @@ business_compare (EContact *contact1,
                  const gchar *ldap_attr)
 {
        gint phone_ids[2] = { E_CONTACT_PHONE_BUSINESS, E_CONTACT_PHONE_BUSINESS_2 };
-       const gchar *phone1, *phone2;
+       gchar *phone1, *phone2;
        gint i;
 
        for (i = 0; i < 2; i++) {
@@ -2927,6 +2930,9 @@ business_compare (EContact *contact1,
                else
                        equal = (!!phone1 == !!phone2);
 
+               g_free (phone1);
+               g_free (phone2);
+
                if (!equal)
                        return equal;
        }
diff --git a/src/camel/providers/nntp/camel-nntp-store.c b/src/camel/providers/nntp/camel-nntp-store.c
index bd59dc016..7f7aba579 100644
--- a/src/camel/providers/nntp/camel-nntp-store.c
+++ b/src/camel/providers/nntp/camel-nntp-store.c
@@ -1442,6 +1442,9 @@ nntp_migrate_to_user_cache_dir (CamelService *service)
                        /* return back the .ev-store-summary file, it's saved in user_data_dir */
                        if (g_rename (ucd_ev_store_summary, udd_ev_store_summary) == -1)
                                g_debug ("%s: Failed to return back '%s' to '%s': %s", G_STRFUNC, 
ucd_ev_store_summary, udd_ev_store_summary, g_strerror (errno));
+
+                       g_free (udd_ev_store_summary);
+                       g_free (ucd_ev_store_summary);
                }
        }
 


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