From 1f8533ef69d034a3ea66017da5b49154b7dca144 Mon Sep 17 00:00:00 2001 From: Andy Holmes Date: Sun, 13 Oct 2024 12:24:08 -0700 Subject: [PATCH] fix(contacts): plug memory leak --- src/libvalent/contacts/valent-contact.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/libvalent/contacts/valent-contact.c b/src/libvalent/contacts/valent-contact.c index 06b4fa6268..4c45aa9558 100644 --- a/src/libvalent/contacts/valent-contact.c +++ b/src/libvalent/contacts/valent-contact.c @@ -24,7 +24,6 @@ valent_contact_resource_from_econtact (EContact *contact) // g_autolist (EVCardAttribute) postal_addresses = NULL; g_autoptr (EContactDate) birthdate = NULL; g_autofree char *vcard = NULL; - const char *uid = NULL; static struct { EContactField field; @@ -56,17 +55,15 @@ valent_contact_resource_from_econtact (EContact *contact) g_return_val_if_fail (E_IS_CONTACT (contact), NULL); - uid = e_contact_get_const (contact, E_CONTACT_UID); - vcard = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_21); - /* NOTE: nco:PersonContact is used unconditionally, because it's the only * class which receives change notification. */ resource = tracker_resource_new (NULL); tracker_resource_set_uri (resource, "rdf:type", "nco:PersonContact"); + + vcard = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_21); tracker_resource_set_string (resource, "nie:plainTextContent", vcard); - contact = e_contact_new_from_vcard_with_uid (vcard, uid); for (size_t i = 0; i < G_N_ELEMENTS (contact_fields); i++) { const char *value = NULL;