summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlavio Ceolin <flavio.ceolin@gmail.com>2015-08-07 16:02:20 -0300
committerFlavio Ceolin <flavio.ceolin@gmail.com>2015-08-16 20:26:52 -0300
commit57c8b53d3423d1779ef2e40fa4ba410d6c4e524f (patch)
tree1654819e0092b9ec1d35496dc39c061bb3ba4806
parentf14d72cc4b3aeb2cd0ea1b223cfe46fa32251244 (diff)
buddies: Fix memory leakHEADmaster
Release the msg's memory if it's not used by nobody.
-rw-r--r--src/bin/buddies.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/bin/buddies.c b/src/bin/buddies.c
index 70b89a5..cbcc6fd 100644
--- a/src/bin/buddies.c
+++ b/src/bin/buddies.c
@@ -842,7 +842,7 @@ _recv_msg(Channel *ch, Eldbus_Message_Iter *iter, Eina_Bool show_noti)
842 Message *m; 842 Message *m;
843 Eina_List *l; 843 Eina_List *l;
844 unsigned int contact_handle; 844 unsigned int contact_handle;
845 Eina_Bool noti = EINA_FALSE; 845 Eina_Bool consumed, noti = EINA_FALSE;
846 846
847 if (!ch) return; 847 if (!ch) return;
848 priv = UTIL_PRIV_GET(ch->ci->obj); 848 priv = UTIL_PRIV_GET(ch->ci->obj);
@@ -860,11 +860,13 @@ _recv_msg(Channel *ch, Eldbus_Message_Iter *iter, Eina_Bool show_noti)
860 _get_text, m); 860 _get_text, m);
861 } 861 }
862 862
863 consumed = EINA_FALSE;
863 contact_handle = message_get_contact_handle(m); 864 contact_handle = message_get_contact_handle(m);
864 EINA_LIST_FOREACH(ch->ci->contacts, l, c) 865 EINA_LIST_FOREACH(ch->ci->contacts, l, c)
865 { 866 {
866 if (c->handle == contact_handle) 867 if (c->handle == contact_handle)
867 { 868 {
869 consumed = EINA_TRUE;
868 c->msg = eina_list_sorted_insert(c->msg, 870 c->msg = eina_list_sorted_insert(c->msg,
869 _sort_msg_by_time, 871 _sort_msg_by_time,
870 m); 872 m);
@@ -887,6 +889,8 @@ _recv_msg(Channel *ch, Eldbus_Message_Iter *iter, Eina_Bool show_noti)
887 break; 889 break;
888 } 890 }
889 } 891 }
892 if (!consumed)
893 message_free(m);
890 } 894 }
891} 895}
892 896