aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-message.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-11-24 19:00:11 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-11-24 20:43:32 +0800
commitb9ea52dc856586cc2876f698a35a6f4a912e8071 (patch)
tree67ad5aedb5edecffa6b06aa285e8662563f200c9 /libempathy/empathy-message.c
parentaa538c7dca8eb35b813e30db34cbcea17ab54c9e (diff)
downloadgsoc2013-empathy-b9ea52dc856586cc2876f698a35a6f4a912e8071.tar
gsoc2013-empathy-b9ea52dc856586cc2876f698a35a6f4a912e8071.tar.gz
gsoc2013-empathy-b9ea52dc856586cc2876f698a35a6f4a912e8071.tar.bz2
gsoc2013-empathy-b9ea52dc856586cc2876f698a35a6f4a912e8071.tar.lz
gsoc2013-empathy-b9ea52dc856586cc2876f698a35a6f4a912e8071.tar.xz
gsoc2013-empathy-b9ea52dc856586cc2876f698a35a6f4a912e8071.tar.zst
gsoc2013-empathy-b9ea52dc856586cc2876f698a35a6f4a912e8071.zip
empathy_message_from_tpl_log_entry: don't leak receiver and sender
Diffstat (limited to 'libempathy/empathy-message.c')
-rw-r--r--libempathy/empathy-message.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/libempathy/empathy-message.c b/libempathy/empathy-message.c
index 0ac6e01b5..ca3b020ac 100644
--- a/libempathy/empathy-message.c
+++ b/libempathy/empathy-message.c
@@ -267,6 +267,7 @@ empathy_message_from_tpl_log_entry (TplEntry *logentry)
TplEntity *receiver = NULL;
TplEntity *sender = NULL;
gchar *body= NULL;
+ EmpathyContact *contact;
g_return_val_if_fail (TPL_IS_ENTRY (logentry), NULL);
@@ -303,12 +304,17 @@ empathy_message_from_tpl_log_entry (TplEntry *logentry)
sender = tpl_entry_get_sender (logentry);
retval = empathy_message_new (body);
- if (receiver != NULL)
- empathy_message_set_receiver (retval,
- empathy_contact_from_tpl_contact (account, receiver));
- if (sender != NULL)
- empathy_message_set_sender (retval,
- empathy_contact_from_tpl_contact (account, sender));
+ if (receiver != NULL) {
+ contact = empathy_contact_from_tpl_contact (account, receiver);
+ empathy_message_set_receiver (retval, contact);
+ g_object_unref (contact);
+ }
+
+ if (sender != NULL) {
+ contact = empathy_contact_from_tpl_contact (account, sender);
+ empathy_message_set_sender (retval, contact);
+ g_object_unref (contact);
+ }
empathy_message_set_timestamp (retval,
tpl_entry_get_timestamp (logentry));