[evolution-ews/gnome-43] ebb_ews_mailbox_to_contact: Fix a memory leak
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews/gnome-43] ebb_ews_mailbox_to_contact: Fix a memory leak
- Date: Tue, 4 Oct 2022 09:04:27 +0000 (UTC)
commit 8decc75b59bda324256d97e8a537d371616adda9
Author: Milan Crha <mcrha redhat com>
Date: Tue Oct 4 11:02:16 2022 +0200
ebb_ews_mailbox_to_contact: Fix a memory leak
The 'value' is not consumed by the e_vcard_attribute_add_value(),
thus either steal it or properly free it.
src/EWS/addressbook/e-book-backend-ews.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/EWS/addressbook/e-book-backend-ews.c b/src/EWS/addressbook/e-book-backend-ews.c
index d8d4b8dc..6974460e 100644
--- a/src/EWS/addressbook/e-book-backend-ews.c
+++ b/src/EWS/addressbook/e-book-backend-ews.c
@@ -2256,12 +2256,13 @@ ebb_ews_mailbox_to_contact (EBookBackendEws *bbews,
e_vcard_attribute_add_value (attr, value);
e_vcard_append_attribute (E_VCARD (*contact), attr);
- if (values)
- g_hash_table_insert (values, g_strdup (value), GINT_TO_POINTER (1));
- } else {
- g_free (value);
+ if (values) {
+ g_hash_table_insert (values, value, GINT_TO_POINTER (1));
+ value = NULL;
+ }
}
+ g_free (value);
g_object_unref (addr);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]