[evolution] bbdb_merge_buddy_to_contact: Use provided new() function and fix possible memory leak



commit f35dfd7d3525105a55519385c093f6eb5cba91bf
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jan 21 23:04:27 2020 +0100

    bbdb_merge_buddy_to_contact: Use provided new() function and fix possible memory leak

 src/plugins/bbdb/gaimbuddies.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/src/plugins/bbdb/gaimbuddies.c b/src/plugins/bbdb/gaimbuddies.c
index a306321ce9..65b9e89b43 100644
--- a/src/plugins/bbdb/gaimbuddies.c
+++ b/src/plugins/bbdb/gaimbuddies.c
@@ -394,7 +394,7 @@ bbdb_merge_buddy_to_contact (EBookClient *client,
                if (photo == NULL) {
                        gchar *contents = NULL;
 
-                       photo = g_new0 (EContactPhoto, 1);
+                       photo = e_contact_photo_new ();
                        photo->type = E_CONTACT_PHOTO_TYPE_INLINED;
 
                        if (!g_file_get_contents (
@@ -404,6 +404,7 @@ bbdb_merge_buddy_to_contact (EBookClient *client,
                                        "bbdb: Could not read buddy icon: "
                                        "%s\n", error->message);
                                g_error_free (error);
+                               e_contact_photo_free (photo);
                                return dirty;
                        }
 


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