Commit e63f2ba1 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Fix some memory leaks.

parent 7885a5c8
...@@ -1309,7 +1309,10 @@ static void notify(SalOp *op, SalSubscribeStatus st, const char *eventname, SalB ...@@ -1309,7 +1309,10 @@ static void notify(SalOp *op, SalSubscribeStatus st, const char *eventname, SalB
} }
{ {
LinphoneContent *ct=linphone_content_from_sal_body_handler(body_handler); LinphoneContent *ct=linphone_content_from_sal_body_handler(body_handler);
if (ct) linphone_core_notify_notify_received(lc,lev,eventname,ct); if (ct) {
linphone_core_notify_notify_received(lc,lev,eventname,ct);
linphone_content_unref(ct);
}
} }
if (st!=SalSubscribeNone){ if (st!=SalSubscribeNone){
linphone_event_set_state(lev,linphone_subscription_state_from_sal(st)); linphone_event_set_state(lev,linphone_subscription_state_from_sal(st));
......
...@@ -68,6 +68,7 @@ static char * create_resource_list_xml(const LinphoneFriendList *list) { ...@@ -68,6 +68,7 @@ static char * create_resource_list_xml(const LinphoneFriendList *list) {
/* Close the "entry" element. */ /* Close the "entry" element. */
err = xmlTextWriterEndElement(writer); err = xmlTextWriterEndElement(writer);
} }
if (uri) ms_free(uri);
} }
if (err >= 0) { if (err >= 0) {
/* Close the "list" element. */ /* Close the "list" element. */
...@@ -116,6 +117,7 @@ static void linphone_friend_list_parse_multipart_related_body(LinphoneFriendList ...@@ -116,6 +117,7 @@ static void linphone_friend_list_parse_multipart_related_body(LinphoneFriendList
goto end; goto end;
} }
version = atoi(version_str); version = atoi(version_str);
linphone_free_xml_text_content(version_str);
if (version < list->expected_notification_version) { if (version < list->expected_notification_version) {
ms_warning("rlmi+xml: Discarding received notification with version %d because %d was expected", version, list->expected_notification_version); ms_warning("rlmi+xml: Discarding received notification with version %d because %d was expected", version, list->expected_notification_version);
goto end; goto end;
...@@ -170,6 +172,7 @@ static void linphone_friend_list_parse_multipart_related_body(LinphoneFriendList ...@@ -170,6 +172,7 @@ static void linphone_friend_list_parse_multipart_related_body(LinphoneFriendList
linphone_core_notify_notify_presence_received(list->lc, friend); linphone_core_notify_notify_presence_received(list->lc, friend);
} }
} }
linphone_content_unref(presence_part);
} }
} }
if (cid != NULL) linphone_free_xml_text_content(cid); if (cid != NULL) linphone_free_xml_text_content(cid);
...@@ -379,6 +382,7 @@ void linphone_friend_list_update_subscriptions(LinphoneFriendList *list, Linphon ...@@ -379,6 +382,7 @@ void linphone_friend_list_update_subscriptions(LinphoneFriendList *list, Linphon
linphone_content_set_subtype(content, "resource-lists+xml"); linphone_content_set_subtype(content, "resource-lists+xml");
linphone_content_set_string_buffer(content, xml_content); linphone_content_set_string_buffer(content, xml_content);
linphone_event_send_subscribe(event, content); linphone_event_send_subscribe(event, content);
linphone_content_unref(content);
} }
if (address != NULL) linphone_address_unref(address); if (address != NULL) linphone_address_unref(address);
if (xml_content != NULL) ms_free(xml_content); if (xml_content != NULL) ms_free(xml_content);
...@@ -427,9 +431,11 @@ void linphone_friend_list_notify_presence_received(LinphoneFriendList *list, Lin ...@@ -427,9 +431,11 @@ void linphone_friend_list_notify_presence_received(LinphoneFriendList *list, Lin
subtype = linphone_content_get_subtype(first_part); subtype = linphone_content_get_subtype(first_part);
if ((strcmp(type, "application") != 0) || (strcmp(subtype, "rlmi+xml") != 0)) { if ((strcmp(type, "application") != 0) || (strcmp(subtype, "rlmi+xml") != 0)) {
ms_warning("multipart presence notified but first part is not 'application/rlmi+xml'"); ms_warning("multipart presence notified but first part is not 'application/rlmi+xml'");
linphone_content_unref(first_part);
return; return;
} }
linphone_friend_list_parse_multipart_related_body(list, body, linphone_content_get_string_buffer(first_part)); linphone_friend_list_parse_multipart_related_body(list, body, linphone_content_get_string_buffer(first_part));
linphone_content_unref(first_part);
} }
} }
...@@ -118,6 +118,7 @@ bool_t linphone_gtk_is_friend(LinphoneCore *lc, const char *contact) { ...@@ -118,6 +118,7 @@ bool_t linphone_gtk_is_friend(LinphoneCore *lc, const char *contact) {
char *uri = linphone_address_as_string_uri_only(addr); char *uri = linphone_address_as_string_uri_only(addr);
LinphoneFriend *lf = linphone_core_get_friend_by_address(lc, uri); LinphoneFriend *lf = linphone_core_get_friend_by_address(lc, uri);
linphone_address_destroy(addr); linphone_address_destroy(addr);
if (uri) ms_free(uri);
if (lf) return TRUE; if (lf) return TRUE;
} }
return FALSE; return FALSE;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment