aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
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 19:00:11 +0800
commit0313474daf288bd973ea491c530d26dd2df0fd28 (patch)
treed3cb45c1d342e12dff55e0f1ac027bff10d13b74 /libempathy
parent74f2bf579605389d30cc8fab50c7718f666ca7ee (diff)
downloadgsoc2013-empathy-0313474daf288bd973ea491c530d26dd2df0fd28.tar
gsoc2013-empathy-0313474daf288bd973ea491c530d26dd2df0fd28.tar.gz
gsoc2013-empathy-0313474daf288bd973ea491c530d26dd2df0fd28.tar.bz2
gsoc2013-empathy-0313474daf288bd973ea491c530d26dd2df0fd28.tar.lz
gsoc2013-empathy-0313474daf288bd973ea491c530d26dd2df0fd28.tar.xz
gsoc2013-empathy-0313474daf288bd973ea491c530d26dd2df0fd28.tar.zst
gsoc2013-empathy-0313474daf288bd973ea491c530d26dd2df0fd28.zip
empathy_message_from_tpl_log_entry: don't leak receiver and sender
Diffstat (limited to 'libempathy')
-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));