Commit 656ff43b authored by Simon Morlat's avatar Simon Morlat

fix most common warnings

parent 5805d4b1
...@@ -597,7 +597,7 @@ lpc_cmd_call(LinphoneCore *lc, char *args) ...@@ -597,7 +597,7 @@ lpc_cmd_call(LinphoneCore *lc, char *args)
{ {
snprintf(callee_name,sizeof(callee_name),"%s",args); snprintf(callee_name,sizeof(callee_name),"%s",args);
} }
linphone_call_params_destroy(cp); linphone_call_params_unref(cp);
} }
return 1; return 1;
} }
...@@ -1981,7 +1981,7 @@ static int lpc_cmd_register(LinphoneCore *lc, char *args){ ...@@ -1981,7 +1981,7 @@ static int lpc_cmd_register(LinphoneCore *lc, char *args){
if ((from=linphone_address_new(identity))!=NULL){ if ((from=linphone_address_new(identity))!=NULL){
info=linphone_auth_info_new(linphone_address_get_username(from),NULL,passwd,NULL,NULL,linphone_address_get_username(from)); info=linphone_auth_info_new(linphone_address_get_username(from),NULL,passwd,NULL,NULL,linphone_address_get_username(from));
linphone_core_add_auth_info(lc,info); linphone_core_add_auth_info(lc,info);
linphone_address_destroy(from); linphone_address_unref(from);
linphone_auth_info_destroy(info); linphone_auth_info_destroy(info);
} }
} }
...@@ -2574,7 +2574,7 @@ static int lpc_cmd_camera(LinphoneCore *lc, char *args){ ...@@ -2574,7 +2574,7 @@ static int lpc_cmd_camera(LinphoneCore *lc, char *args){
LinphoneCallParams *ncp=linphone_call_params_copy(cp); LinphoneCallParams *ncp=linphone_call_params_copy(cp);
linphone_call_params_enable_video(ncp,TRUE); linphone_call_params_enable_video(ncp,TRUE);
linphone_core_update_call(lc,call,ncp); linphone_core_update_call(lc,call,ncp);
linphone_call_params_destroy (ncp); linphone_call_params_unref (ncp);
linphonec_out("Trying to bring up video stream...\n"); linphonec_out("Trying to bring up video stream...\n");
} }
} }
......
...@@ -368,7 +368,7 @@ static void linphonec_call_state_changed(LinphoneCore *lc, LinphoneCall *call, L ...@@ -368,7 +368,7 @@ static void linphonec_call_state_changed(LinphoneCore *lc, LinphoneCall *call, L
linphone_call_params_enable_early_media_sending(callparams, TRUE); linphone_call_params_enable_early_media_sending(callparams, TRUE);
if (vcap_enabled) linphone_call_params_enable_video(callparams, TRUE); if (vcap_enabled) linphone_call_params_enable_video(callparams, TRUE);
linphone_core_accept_early_media_with_params(lc, call, callparams); linphone_core_accept_early_media_with_params(lc, call, callparams);
linphone_call_params_destroy(callparams); linphone_call_params_unref(callparams);
} }
break; break;
case LinphoneCallOutgoingInit: case LinphoneCallOutgoingInit:
...@@ -796,7 +796,7 @@ linphonec_finish(int exit_status) ...@@ -796,7 +796,7 @@ linphonec_finish(int exit_status)
stop_pipe_reader(); stop_pipe_reader();
#endif /*_WIN32_WCE*/ #endif /*_WIN32_WCE*/
linphone_core_destroy (linphonec); linphone_core_unref (linphonec);
if (mylogfile != NULL && mylogfile != stdout) if (mylogfile != NULL && mylogfile != stdout)
{ {
......
...@@ -246,7 +246,7 @@ static char* _get_identity(const LinphoneAccountCreator *creator) { ...@@ -246,7 +246,7 @@ static char* _get_identity(const LinphoneAccountCreator *creator) {
addr = linphone_proxy_config_normalize_sip_uri(proxy, creator->username ? creator->username : creator->phone_number); addr = linphone_proxy_config_normalize_sip_uri(proxy, creator->username ? creator->username : creator->phone_number);
identity = linphone_address_as_string(addr); identity = linphone_address_as_string(addr);
linphone_address_destroy(addr); linphone_address_unref(addr);
linphone_proxy_config_destroy(proxy); linphone_proxy_config_destroy(proxy);
} }
return identity; return identity;
...@@ -550,7 +550,7 @@ LinphoneProxyConfig * linphone_account_creator_configure(const LinphoneAccountCr ...@@ -550,7 +550,7 @@ LinphoneProxyConfig * linphone_account_creator_configure(const LinphoneAccountCr
linphone_proxy_config_set_server_addr(cfg, tmp); linphone_proxy_config_set_server_addr(cfg, tmp);
linphone_proxy_config_set_route(cfg, tmp); linphone_proxy_config_set_route(cfg, tmp);
ms_free(tmp); ms_free(tmp);
linphone_address_destroy(addr); linphone_address_unref(addr);
} }
linphone_core_set_stun_server(creator->core, "stun.linphone.org"); linphone_core_set_stun_server(creator->core, "stun.linphone.org");
linphone_core_set_firewall_policy(creator->core, LinphonePolicyUseIce); linphone_core_set_firewall_policy(creator->core, LinphonePolicyUseIce);
...@@ -564,7 +564,7 @@ LinphoneProxyConfig * linphone_account_creator_configure(const LinphoneAccountCr ...@@ -564,7 +564,7 @@ LinphoneProxyConfig * linphone_account_creator_configure(const LinphoneAccountCr
linphone_address_get_domain(identity) // domain linphone_address_get_domain(identity) // domain
); );
linphone_core_add_auth_info(creator->core, info); linphone_core_add_auth_info(creator->core, info);
linphone_address_destroy(identity); linphone_address_unref(identity);
if (linphone_core_add_proxy_config(creator->core, cfg) != -1) { if (linphone_core_add_proxy_config(creator->core, cfg) != -1) {
linphone_core_set_default_proxy(creator->core, cfg); linphone_core_set_default_proxy(creator->core, cfg);
......
...@@ -163,7 +163,7 @@ bool_t linphone_address_equal(const LinphoneAddress *a1, const LinphoneAddress * ...@@ -163,7 +163,7 @@ bool_t linphone_address_equal(const LinphoneAddress *a1, const LinphoneAddress *
} }
void linphone_address_destroy(LinphoneAddress *u){ void linphone_address_destroy(LinphoneAddress *u){
sal_address_unref(u); linphone_address_unref(u);
} }
void linphone_address_set_password(LinphoneAddress *addr, const char *passwd){ void linphone_address_set_password(LinphoneAddress *addr, const char *passwd){
......
...@@ -281,8 +281,8 @@ void linphone_call_log_unref(LinphoneCallLog *cl) { ...@@ -281,8 +281,8 @@ void linphone_call_log_unref(LinphoneCallLog *cl) {
******************************************************************************/ ******************************************************************************/
static void _linphone_call_log_destroy(LinphoneCallLog *cl) { static void _linphone_call_log_destroy(LinphoneCallLog *cl) {
if (cl->from!=NULL) linphone_address_destroy(cl->from); if (cl->from!=NULL) linphone_address_unref(cl->from);
if (cl->to!=NULL) linphone_address_destroy(cl->to); if (cl->to!=NULL) linphone_address_unref(cl->to);
if (cl->refkey!=NULL) ms_free(cl->refkey); if (cl->refkey!=NULL) ms_free(cl->refkey);
if (cl->call_id) ms_free(cl->call_id); if (cl->call_id) ms_free(cl->call_id);
if (cl->reporting.reports[LINPHONE_CALL_STATS_AUDIO]!=NULL) linphone_reporting_destroy(cl->reporting.reports[LINPHONE_CALL_STATS_AUDIO]); if (cl->reporting.reports[LINPHONE_CALL_STATS_AUDIO]!=NULL) linphone_reporting_destroy(cl->reporting.reports[LINPHONE_CALL_STATS_AUDIO]);
...@@ -454,10 +454,10 @@ static int create_call_log(void *data, int argc, char **argv, char **colName) { ...@@ -454,10 +454,10 @@ static int create_call_log(void *data, int argc, char **argv, char **colName) {
error: error:
if (from){ if (from){
linphone_address_destroy(from); linphone_address_unref(from);
} }
if (to){ if (to){
linphone_address_destroy(to); linphone_address_unref(to);
} }
ms_error("Bad call log at storage_id %u", storage_id); ms_error("Bad call log at storage_id %u", storage_id);
return 0; return 0;
......
...@@ -340,7 +340,7 @@ bool_t linphone_call_params_video_multicast_enabled(const LinphoneCallParams *pa ...@@ -340,7 +340,7 @@ bool_t linphone_call_params_video_multicast_enabled(const LinphoneCallParams *pa
* Constructor and destructor functions * * Constructor and destructor functions *
******************************************************************************/ ******************************************************************************/
static void _linphone_call_params_destroy(LinphoneCallParams *cp){ static void _linphone_call_params_unref(LinphoneCallParams *cp){
unsigned int i; unsigned int i;
if (cp->record_file) ms_free(cp->record_file); if (cp->record_file) ms_free(cp->record_file);
if (cp->custom_headers) sal_custom_header_free(cp->custom_headers); if (cp->custom_headers) sal_custom_header_free(cp->custom_headers);
...@@ -368,7 +368,7 @@ void linphone_call_params_destroy(LinphoneCallParams *cp) { ...@@ -368,7 +368,7 @@ void linphone_call_params_destroy(LinphoneCallParams *cp) {
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneCallParams); BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneCallParams);
BELLE_SIP_INSTANCIATE_VPTR(LinphoneCallParams, belle_sip_object_t, BELLE_SIP_INSTANCIATE_VPTR(LinphoneCallParams, belle_sip_object_t,
(belle_sip_object_destroy_t)_linphone_call_params_destroy, (belle_sip_object_destroy_t)_linphone_call_params_unref,
NULL, // clone NULL, // clone
NULL, // marshal NULL, // marshal
FALSE FALSE
......
...@@ -334,13 +334,13 @@ static void call_received(SalOp *h){ ...@@ -334,13 +334,13 @@ static void call_received(SalOp *h){
ms_warning("Receiving a call while one with same address [%s] is initiated, refusing this one with busy message.",addr); ms_warning("Receiving a call while one with same address [%s] is initiated, refusing this one with busy message.",addr);
sal_call_decline(h,SalReasonBusy,NULL); sal_call_decline(h,SalReasonBusy,NULL);
sal_op_release(h); sal_op_release(h);
linphone_address_destroy(from_addr); linphone_address_unref(from_addr);
linphone_address_destroy(to_addr); linphone_address_unref(to_addr);
linphone_address_destroy(from_address_to_search_if_me); linphone_address_unref(from_address_to_search_if_me);
ms_free(addr); ms_free(addr);
return; return;
} else if (from_address_to_search_if_me) { } else if (from_address_to_search_if_me) {
linphone_address_destroy(from_address_to_search_if_me); linphone_address_unref(from_address_to_search_if_me);
} }
call=linphone_call_new_incoming(lc,from_addr,to_addr,h); call=linphone_call_new_incoming(lc,from_addr,to_addr,h);
...@@ -748,7 +748,7 @@ static void call_updating(SalOp *op, bool_t is_update){ ...@@ -748,7 +748,7 @@ static void call_updating(SalOp *op, bool_t is_update){
LinphoneCallParams *p=linphone_core_create_call_params(lc, NULL); LinphoneCallParams *p=linphone_core_create_call_params(lc, NULL);
ms_message("Applying default policy for offering SDP on call [%p]",call); ms_message("Applying default policy for offering SDP on call [%p]",call);
linphone_call_set_new_params(call, p); linphone_call_set_new_params(call, p);
linphone_call_params_destroy(p); linphone_call_params_unref(p);
} }
linphone_call_make_local_media_description(call); linphone_call_make_local_media_description(call);
sal_call_set_local_media_description(call->op,call->localdesc); sal_call_set_local_media_description(call->op,call->localdesc);
...@@ -1127,7 +1127,7 @@ static void refer_received(Sal *sal, SalOp *op, const char *referto){ ...@@ -1127,7 +1127,7 @@ static void refer_received(Sal *sal, SalOp *op, const char *referto){
if(refer_to_addr) { if(refer_to_addr) {
const char *tmp = linphone_address_get_method_param(refer_to_addr); const char *tmp = linphone_address_get_method_param(refer_to_addr);
if(tmp) strncpy(method, tmp, sizeof(method)); if(tmp) strncpy(method, tmp, sizeof(method));
linphone_address_destroy(refer_to_addr); linphone_address_unref(refer_to_addr);
} }
if (call && (strlen(method) == 0 || strcmp(method, "INVITE") == 0)) { if (call && (strlen(method) == 0 || strcmp(method, "INVITE") == 0)) {
if (call->refer_to!=NULL){ if (call->refer_to!=NULL){
......
...@@ -130,7 +130,7 @@ static void _linphone_chat_room_destroy(LinphoneChatRoom *cr) { ...@@ -130,7 +130,7 @@ static void _linphone_chat_room_destroy(LinphoneChatRoom *cr) {
cr->lc->chatrooms = bctbx_list_remove(cr->lc->chatrooms, cr); cr->lc->chatrooms = bctbx_list_remove(cr->lc->chatrooms, cr);
} }
} }
linphone_address_destroy(cr->peer_url); linphone_address_unref(cr->peer_url);
if (cr->pending_message) if (cr->pending_message)
linphone_chat_message_destroy(cr->pending_message); linphone_chat_message_destroy(cr->pending_message);
ms_free(cr->peer); ms_free(cr->peer);
...@@ -243,7 +243,7 @@ static LinphoneChatRoom *_linphone_core_get_or_create_chat_room(LinphoneCore *lc ...@@ -243,7 +243,7 @@ static LinphoneChatRoom *_linphone_core_get_or_create_chat_room(LinphoneCore *lc
return NULL; return NULL;
} }
ret = _linphone_core_get_chat_room(lc, to_addr); ret = _linphone_core_get_chat_room(lc, to_addr);
linphone_address_destroy(to_addr); linphone_address_unref(to_addr);
if (!ret) { if (!ret) {
ret = _linphone_core_create_chat_room_from_url(lc, to); ret = _linphone_core_create_chat_room_from_url(lc, to);
} }
...@@ -405,7 +405,7 @@ void _linphone_chat_room_send_message(LinphoneChatRoom *cr, LinphoneChatMessage ...@@ -405,7 +405,7 @@ void _linphone_chat_room_send_message(LinphoneChatRoom *cr, LinphoneChatMessage
* BUG * BUG
* the file transfer message constructor sets the from, but doesn't do it as well as here. * the file transfer message constructor sets the from, but doesn't do it as well as here.
*/ */
linphone_address_destroy(msg->from); linphone_address_unref(msg->from);
} }
msg->from = linphone_address_new(identity); msg->from = linphone_address_new(identity);
...@@ -660,7 +660,7 @@ LinphoneReason linphone_core_message_received(LinphoneCore *lc, SalOp *op, const ...@@ -660,7 +660,7 @@ LinphoneReason linphone_core_message_received(LinphoneCore *lc, SalOp *op, const
linphone_chat_room_message_received(cr, lc, msg); linphone_chat_room_message_received(cr, lc, msg);
end: end:
linphone_address_destroy(addr); linphone_address_unref(addr);
linphone_chat_message_unref(msg); linphone_chat_message_unref(msg);
return reason; return reason;
} }
...@@ -769,7 +769,7 @@ LinphoneReason linphone_core_is_composing_received(LinphoneCore *lc, SalOp *op, ...@@ -769,7 +769,7 @@ LinphoneReason linphone_core_is_composing_received(LinphoneCore *lc, SalOp *op,
} }
linphone_chat_message_unref(msg); linphone_chat_message_unref(msg);
} }
linphone_address_destroy(addr); linphone_address_unref(addr);
return reason; return reason;
} }
...@@ -864,7 +864,7 @@ LinphoneReason linphone_core_imdn_received(LinphoneCore *lc, SalOp *op, const Sa ...@@ -864,7 +864,7 @@ LinphoneReason linphone_core_imdn_received(LinphoneCore *lc, SalOp *op, const Sa
if (cr != NULL) { if (cr != NULL) {
linphone_chat_room_notify_imdn(cr, imdn->content); linphone_chat_room_notify_imdn(cr, imdn->content);
} }
linphone_address_destroy(addr); linphone_address_unref(addr);
return LinphoneReasonNone; return LinphoneReasonNone;
} }
...@@ -1030,8 +1030,8 @@ static void linphone_chat_room_send_is_composing_notification(LinphoneChatRoom * ...@@ -1030,8 +1030,8 @@ static void linphone_chat_room_send_is_composing_notification(LinphoneChatRoom *
} }
linphone_chat_message_unref(msg); linphone_chat_message_unref(msg);
linphone_address_destroy(from_addr); linphone_address_unref(from_addr);
linphone_address_destroy(to_addr); linphone_address_unref(to_addr);
ms_free(content); ms_free(content);
sal_op_unref(op); sal_op_unref(op);
} }
...@@ -1182,8 +1182,8 @@ static void linphone_chat_message_send_imdn(LinphoneChatMessage *cm, enum ImdnTy ...@@ -1182,8 +1182,8 @@ static void linphone_chat_message_send_imdn(LinphoneChatMessage *cm, enum ImdnTy
} }
linphone_chat_message_unref(msg); linphone_chat_message_unref(msg);
linphone_address_destroy(from_addr); linphone_address_unref(from_addr);
linphone_address_destroy(to_addr); linphone_address_unref(to_addr);
ms_free(content); ms_free(content);
} }
sal_op_unref(op); sal_op_unref(op);
...@@ -1259,7 +1259,7 @@ void linphone_core_real_time_text_received(LinphoneCore *lc, LinphoneChatRoom *c ...@@ -1259,7 +1259,7 @@ void linphone_core_real_time_text_received(LinphoneCore *lc, LinphoneChatRoom *c
linphone_chat_message_set_from(msg, cr->peer_url); linphone_chat_message_set_from(msg, cr->peer_url);
if (msg->to) if (msg->to)
linphone_address_destroy(msg->to); linphone_address_unref(msg->to);
msg->to = call->dest_proxy ? linphone_address_clone(call->dest_proxy->identity_address) : msg->to = call->dest_proxy ? linphone_address_clone(call->dest_proxy->identity_address) :
linphone_address_new(linphone_core_get_identity(lc)); linphone_address_new(linphone_core_get_identity(lc));
msg->time = ms_time(0); msg->time = ms_time(0);
...@@ -1319,7 +1319,7 @@ int linphone_chat_message_put_char(LinphoneChatMessage *msg, uint32_t character) ...@@ -1319,7 +1319,7 @@ int linphone_chat_message_put_char(LinphoneChatMessage *msg, uint32_t character)
msg->time = ms_time(0); msg->time = ms_time(0);
msg->state = LinphoneChatMessageStateDisplayed; msg->state = LinphoneChatMessageStateDisplayed;
msg->dir = LinphoneChatMessageOutgoing; msg->dir = LinphoneChatMessageOutgoing;
if (msg->from) linphone_address_destroy(msg->from); if (msg->from) linphone_address_unref(msg->from);
msg->from = linphone_address_new(linphone_core_get_identity(lc)); msg->from = linphone_address_new(linphone_core_get_identity(lc));
msg->storage_id = linphone_chat_message_store(msg); msg->storage_id = linphone_chat_message_store(msg);
ms_free(msg->message); ms_free(msg->message);
...@@ -1441,7 +1441,7 @@ void linphone_chat_message_set_appdata(LinphoneChatMessage *msg, const char *dat ...@@ -1441,7 +1441,7 @@ void linphone_chat_message_set_appdata(LinphoneChatMessage *msg, const char *dat
void linphone_chat_message_set_from_address(LinphoneChatMessage *msg, const LinphoneAddress *from) { void linphone_chat_message_set_from_address(LinphoneChatMessage *msg, const LinphoneAddress *from) {
if (msg->from) if (msg->from)
linphone_address_destroy(msg->from); linphone_address_unref(msg->from);
msg->from = linphone_address_clone(from); msg->from = linphone_address_clone(from);
} }
...@@ -1451,7 +1451,7 @@ const LinphoneAddress *linphone_chat_message_get_from_address(const LinphoneChat ...@@ -1451,7 +1451,7 @@ const LinphoneAddress *linphone_chat_message_get_from_address(const LinphoneChat
void linphone_chat_message_set_to_address(LinphoneChatMessage *msg, const LinphoneAddress *to) { void linphone_chat_message_set_to_address(LinphoneChatMessage *msg, const LinphoneAddress *to) {
if (msg->to) if (msg->to)
linphone_address_destroy(msg->to); linphone_address_unref(msg->to);
msg->to = linphone_address_clone(to); msg->to = linphone_address_clone(to);
} }
...@@ -1552,9 +1552,9 @@ static void _linphone_chat_message_destroy(LinphoneChatMessage *msg) { ...@@ -1552,9 +1552,9 @@ static void _linphone_chat_message_destroy(LinphoneChatMessage *msg) {
if (msg->appdata) if (msg->appdata)
ms_free(msg->appdata); ms_free(msg->appdata);
if (msg->from) if (msg->from)
linphone_address_destroy(msg->from); linphone_address_unref(msg->from);
if (msg->to) if (msg->to)
linphone_address_destroy(msg->to); linphone_address_unref(msg->to);
if (msg->message_id) if (msg->message_id)
ms_free(msg->message_id); ms_free(msg->message_id);
if (msg->custom_headers) if (msg->custom_headers)
......
...@@ -404,7 +404,7 @@ int LocalConference::addParticipant(LinphoneCall *call) { ...@@ -404,7 +404,7 @@ int LocalConference::addParticipant(LinphoneCall *call) {
/*this will trigger a reINVITE that will later redraw the streams */ /*this will trigger a reINVITE that will later redraw the streams */
/*FIXME probably a bit too much to just redraw streams !*/ /*FIXME probably a bit too much to just redraw streams !*/
linphone_core_update_call(m_core,call,params); linphone_core_update_call(m_core,call,params);
linphone_call_params_destroy(params); linphone_call_params_unref(params);
addLocalEndpoint(); addLocalEndpoint();
}else{ }else{
ms_error("Call is in state %s, it cannot be added to the conference.",linphone_call_state_to_string(call->state)); ms_error("Call is in state %s, it cannot be added to the conference.",linphone_call_state_to_string(call->state));
...@@ -441,7 +441,7 @@ int LocalConference::removeFromConference(LinphoneCall *call, bool_t active){ ...@@ -441,7 +441,7 @@ int LocalConference::removeFromConference(LinphoneCall *call, bool_t active){
} }
ms_message("Updating call to actually remove from conference"); ms_message("Updating call to actually remove from conference");
err=linphone_core_update_call(m_core,call,params); err=linphone_core_update_call(m_core,call,params);
linphone_call_params_destroy(params); linphone_call_params_unref(params);
} else{ } else{
ms_message("Pausing call to actually remove from conference"); ms_message("Pausing call to actually remove from conference");
err=_linphone_core_pause_call(m_core,call); err=_linphone_core_pause_call(m_core,call);
......
...@@ -54,6 +54,13 @@ LinphoneFactory *linphone_factory_get(void) { ...@@ -54,6 +54,13 @@ LinphoneFactory *linphone_factory_get(void) {
return _factory; return _factory;
} }
void linphone_factory_clean(void){
if (_factory){
belle_sip_object_unref(_factory);
_factory = NULL;
}
}
LinphoneCore *linphone_factory_create_core(const LinphoneFactory *factory, LinphoneCoreCbs *cbs, LinphoneCore *linphone_factory_create_core(const LinphoneFactory *factory, LinphoneCoreCbs *cbs,
const char *config_path, const char *factory_config_path) { const char *config_path, const char *factory_config_path) {
LpConfig *config = lp_config_new_with_factory(config_path, factory_config_path); LpConfig *config = lp_config_new_with_factory(config_path, factory_config_path);
......
...@@ -483,7 +483,7 @@ const char * linphone_friend_list_get_rls_uri(const LinphoneFriendList *list) { ...@@ -483,7 +483,7 @@ const char * linphone_friend_list_get_rls_uri(const LinphoneFriendList *list) {
void linphone_friend_list_set_rls_uri(LinphoneFriendList *list, const char *rls_uri) { void linphone_friend_list_set_rls_uri(LinphoneFriendList *list, const char *rls_uri) {
LinphoneAddress *addr = rls_uri ? linphone_core_create_address(list->lc, rls_uri) : NULL; LinphoneAddress *addr = rls_uri ? linphone_core_create_address(list->lc, rls_uri) : NULL;
linphone_friend_list_set_rls_address(list, addr); linphone_friend_list_set_rls_address(list, addr);
if (addr) linphone_address_destroy(addr); if (addr) linphone_address_unref(addr);
} }
static LinphoneFriendListStatus _linphone_friend_list_add_friend(LinphoneFriendList *list, LinphoneFriend *lf, bool_t synchronize) { static LinphoneFriendListStatus _linphone_friend_list_add_friend(LinphoneFriendList *list, LinphoneFriend *lf, bool_t synchronize) {
......
...@@ -144,7 +144,7 @@ int main(int argc, char *argv[]){ ...@@ -144,7 +144,7 @@ int main(int argc, char *argv[]){
linphone_proxy_config_set_server_addr(proxy_cfg,linphone_address_get_domain(from)); /* we assume domain = proxy server address*/ linphone_proxy_config_set_server_addr(proxy_cfg,linphone_address_get_domain(from)); /* we assume domain = proxy server address*/
linphone_proxy_config_enable_register(proxy_cfg,TRUE); /*activate registration for this proxy config*/ linphone_proxy_config_enable_register(proxy_cfg,TRUE); /*activate registration for this proxy config*/
linphone_proxy_config_enable_publish(proxy_cfg,TRUE); /* enable presence satus publication for this proxy*/ linphone_proxy_config_enable_publish(proxy_cfg,TRUE); /* enable presence satus publication for this proxy*/
linphone_address_destroy(from); /*release resource*/ linphone_address_unref(from); /*release resource*/
linphone_core_add_proxy_config(lc,proxy_cfg); /*add proxy config to linphone core*/ linphone_core_add_proxy_config(lc,proxy_cfg); /*add proxy config to linphone core*/
linphone_core_set_default_proxy(lc,proxy_cfg); /*set to default proxy*/ linphone_core_set_default_proxy(lc,proxy_cfg); /*set to default proxy*/
......
...@@ -136,7 +136,7 @@ int main(int argc, char *argv[]){ ...@@ -136,7 +136,7 @@ int main(int argc, char *argv[]){
server_addr = linphone_address_get_domain(from); /*extract domain address from identity*/ server_addr = linphone_address_get_domain(from); /*extract domain address from identity*/
linphone_proxy_config_set_server_addr(proxy_cfg,server_addr); /* we assume domain = proxy server address*/ linphone_proxy_config_set_server_addr(proxy_cfg,server_addr); /* we assume domain = proxy server address*/
linphone_proxy_config_enable_register(proxy_cfg,TRUE); /*activate registration for this proxy config*/ linphone_proxy_config_enable_register(proxy_cfg,TRUE); /*activate registration for this proxy config*/
linphone_address_destroy(from); /*release resource*/ linphone_address_unref(from); /*release resource*/
linphone_core_add_proxy_config(lc,proxy_cfg); /*add proxy config to linphone core*/ linphone_core_add_proxy_config(lc,proxy_cfg); /*add proxy config to linphone core*/
linphone_core_set_default_proxy(lc,proxy_cfg); /*set to default proxy*/ linphone_core_set_default_proxy(lc,proxy_cfg); /*set to default proxy*/
......
...@@ -77,7 +77,7 @@ int main(int argc, char *argv[]){ ...@@ -77,7 +77,7 @@ int main(int argc, char *argv[]){
LinphoneCallParams *cp = linphone_core_create_call_params(lc, NULL); LinphoneCallParams *cp = linphone_core_create_call_params(lc, NULL);
linphone_call_params_enable_realtime_text(cp,TRUE); /*enable real time text*/ linphone_call_params_enable_realtime_text(cp,TRUE); /*enable real time text*/
call=linphone_core_invite_with_params(lc,dest,cp); call=linphone_core_invite_with_params(lc,dest,cp);
linphone_call_params_destroy(cp); linphone_call_params_unref(cp);
if (call==NULL){ if (call==NULL){
printf("Could not place call to %s\n",dest); printf("Could not place call to %s\n",dest);
goto end; goto end;
......
...@@ -109,7 +109,7 @@ int main(int argc, char *argv[]){ ...@@ -109,7 +109,7 @@ int main(int argc, char *argv[]){
server_addr = linphone_address_get_domain(from); /*extract domain address from identity*/ server_addr = linphone_address_get_domain(from); /*extract domain address from identity*/
linphone_proxy_config_set_server_addr(proxy_cfg,server_addr); /* we assume domain = proxy server address*/ linphone_proxy_config_set_server_addr(proxy_cfg,server_addr); /* we assume domain = proxy server address*/
linphone_proxy_config_enable_register(proxy_cfg,TRUE); /*activate registration for this proxy config*/ linphone_proxy_config_enable_register(proxy_cfg,TRUE); /*activate registration for this proxy config*/
linphone_address_destroy(from); /*release resource*/ linphone_address_unref(from); /*release resource*/
linphone_core_add_proxy_config(lc,proxy_cfg); /*add proxy config to linphone core*/ linphone_core_add_proxy_config(lc,proxy_cfg); /*add proxy config to linphone core*/
linphone_core_set_default_proxy(lc,proxy_cfg); /*set to default proxy*/ linphone_core_set_default_proxy(lc,proxy_cfg); /*set to default proxy*/
......
...@@ -228,7 +228,7 @@ static void linphone_ldap_contact_provider_handle_search_result( LinphoneLDAPCon ...@@ -228,7 +228,7 @@ static void linphone_ldap_contact_provider_handle_search_result( LinphoneLDAPCon
//ms_message("Added friend %s / %s", ldap_data.name, ldap_data.sip); //ms_message("Added friend %s / %s", ldap_data.name, ldap_data.sip);
ms_free(ldap_data.sip); ms_free(ldap_data.sip);
ms_free(ldap_data.name); ms_free(ldap_data.name);
linphone_address_destroy(la); linphone_address_unref(la);
} }
} }
......
...@@ -894,7 +894,7 @@ void linphone_call_make_local_media_description(LinphoneCall *call) { ...@@ -894,7 +894,7 @@ void linphone_call_make_local_media_description(LinphoneCall *call) {
update_media_description_from_stun(md, &call->ac, &call->vc, &call->tc); update_media_description_from_stun(md, &call->ac, &call->vc, &call->tc);
call->localdesc=md; call->localdesc=md;
linphone_call_update_local_media_description_from_ice_or_upnp(call); linphone_call_update_local_media_description_from_ice_or_upnp(call);
linphone_address_destroy(addr); linphone_address_unref(addr);
if (old_md){ if (old_md){
transfer_already_assigned_payload_types(old_md,md); transfer_already_assigned_payload_types(old_md,md);
call->localdesc_changed=sal_media_description_equals(md,old_md); call->localdesc_changed=sal_media_description_equals(md,old_md);
...@@ -4696,7 +4696,7 @@ void linphone_call_set_contact_op(LinphoneCall* call) { ...@@ -4696,7 +4696,7 @@ void linphone_call_set_contact_op(LinphoneCall* call) {
sal_address_clean((SalAddress*)contact); /* clean out contact_params that come from proxy config*/ sal_address_clean((SalAddress*)contact); /* clean out contact_params that come from proxy config*/
sal_address_set_transport((SalAddress*)contact,tport); sal_address_set_transport((SalAddress*)contact,tport);
sal_op_set_contact_address(call->op, contact); sal_op_set_contact_address(call->op, contact);
linphone_address_destroy(contact); linphone_address_unref(contact);
} }
} }
......
...@@ -2079,7 +2079,7 @@ int linphone_core_set_primary_contact(LinphoneCore *lc, const char *contact) { ...@@ -2079,7 +2079,7 @@ int linphone_core_set_primary_contact(LinphoneCore *lc, const char *contact) {
ms_free(lc->sip_conf.guessed_contact); ms_free(lc->sip_conf.guessed_contact);
lc->sip_conf.guessed_contact=NULL; lc->sip_conf.guessed_contact=NULL;
} }
linphone_address_destroy(ctt); linphone_address_unref(ctt);
return 0; return 0;
} }
...@@ -2110,7 +2110,7 @@ static void update_primary_contact(LinphoneCore *lc){ ...@@ -2110,7 +2110,7 @@ static void update_primary_contact(LinphoneCore *lc){
it won't work. But we prefer to return something in all cases. It at least shows username and ip address.*/ it won't work. But we prefer to return something in all cases. It at least shows username and ip address.*/
guessed=linphone_address_as_string(url); guessed=linphone_address_as_string(url);
lc->sip_conf.guessed_contact=guessed; lc->sip_conf.guessed_contact=guessed;
linphone_address_destroy(url); linphone_address_unref(url);
} }
const char *linphone_core_get_primary_contact(LinphoneCore *lc){ const char *linphone_core_get_primary_contact(LinphoneCore *lc){
...@@ -2918,7 +2918,7 @@ LinphoneCall * linphone_core_start_refered_call(LinphoneCore *lc, LinphoneCall * ...@@ -2918,7 +2918,7 @@ LinphoneCall * linphone_core_start_refered_call(LinphoneCore *lc, LinphoneCall *
ms_message("Starting new call to refered address %s",call->refer_to); ms_message("Starting new call to refered address %s",call->refer_to);
call->refer_pending=FALSE; call->refer_pending=FALSE;
newcall=linphone_core_invite_with_params(lc,call->refer_to,cp); newcall=linphone_core_invite_with_params(lc,call->refer_to,cp);
linphone_call_params_destroy(cp); linphone_call_params_unref(cp);
if (newcall) { if (newcall) {
call->transfer_target=linphone_call_ref(newcall); call->transfer_target=linphone_call_ref(newcall);
linphone_core_notify_refer_state(lc,call,newcall); linphone_core_notify_refer_state(lc,call,newcall);
...@@ -3132,7 +3132,7 @@ LinphoneCall * linphone_core_invite(LinphoneCore *lc, const char *url){ ...@@ -3132,7 +3132,7 @@ LinphoneCall * linphone_core_invite(LinphoneCore *lc, const char *url){
LinphoneCallParams *p=linphone_core_create_call_params(lc, NULL); LinphoneCallParams *p=linphone_core_create_call_params(lc, NULL);
p->has_video &= !!lc->video_policy.automatically_initiate; p->has_video &= !!lc->video_policy.automatically_initiate;
call=linphone_core_invite_with_params(lc,url,p); call=linphone_core_invite_with_params(lc,url,p);
linphone_call_params_destroy(p); linphone_call_params_unref(p);
return call; return call;
} }
...@@ -3141,7 +3141,7 @@ LinphoneCall * linphone_core_invite_with_params(LinphoneCore *lc, const char *ur ...@@ -3141,7 +3141,7 @@ LinphoneCall * linphone_core_invite_with_params(LinphoneCore *lc, const char *ur
if (addr){ if (addr){
LinphoneCall *call; LinphoneCall *call;
call=linphone_core_invite_address_with_params(lc,addr,p); call=linphone_core_invite_address_with_params(lc,addr,p);
linphone_address_destroy(addr); linphone_address_unref(addr);
return call; return call;
} }
return NULL; return NULL;
...@@ -3152,7 +3152,7 @@ LinphoneCall * linphone_core_invite_address(LinphoneCore *lc, const LinphoneAddr ...@@ -3152,7 +3152,7 @@ LinphoneCall * linphone_core_invite_address(LinphoneCore *lc, const LinphoneAddr
LinphoneCallParams *p=linphone_core_create_call_params(lc, NULL); LinphoneCallParams *p=linphone_core_create_call_params(lc, NULL);
p->has_video &= !!lc->video_policy.automatically_initiate; p->has_video &= !!lc->video_policy.automatically_initiate;
call=linphone_core_invite_address_with_params (lc,addr,p); call=linphone_core_invite_address_with_params (lc,addr,p);
linphone_call_params_destroy(p); linphone_call_params_unref(p);
return call; return call;
} }
...@@ -3244,7 +3244,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const ...@@ -3244,7 +3244,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const
{ {
ms_warning("we had a problem in adding the call into the invite ... weird"); ms_warning("we had a problem in adding the call into the invite ... weird");
linphone_call_unref(call); linphone_call_unref(call);
linphone_call_params_destroy(cp); linphone_call_params_unref(cp);
return NULL; return NULL;
} }
...@@ -3294,7 +3294,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const ...@@ -3294,7 +3294,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const
} }
if (real_url!=NULL) ms_free(real_url); if (real_url!=NULL) ms_free(real_url);
linphone_call_params_destroy(cp); linphone_call_params_unref(cp);
return call; return call;
} }
...@@ -3314,7 +3314,7 @@ int linphone_core_transfer_call(LinphoneCore *lc, LinphoneCall *call, const char ...@@ -3314,7 +3314,7 @@ int linphone_core_transfer_call(LinphoneCore *lc, LinphoneCall *call, const char
real_url=linphone_address_as_string (real_parsed_url); real_url=linphone_address_as_string (real_parsed_url);
sal_call_refer(call->op,real_url); sal_call_refer(call->op,real_url);
ms_free(real_url); ms_free(real_url);
linphone_address_destroy(real_parsed_url); linphone_address_unref(real_parsed_url);
linphone_call_set_transfer_state(call, LinphoneCallOutgoingInit); linphone_call_set_transfer_state(call, LinphoneCallOutgoingInit);
return 0; return 0;
} }
...@@ -3349,7 +3349,7 @@ void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call){ ...@@ -3349,7 +3349,7 @@ void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call){
from_parsed=linphone_address_new(sal_op_get_from(call->op)); from_parsed=linphone_address_new(sal_op_get_from(call->op));
linphone_address_clean(from_parsed); linphone_address_clean(from_parsed);
tmp=linphone_address_as_string(from_parsed); tmp=linphone_address_as_string(from_parsed);
linphone_address_destroy(from_parsed); linphone_address_unref(from_parsed);
barmesg=ortp_strdup_printf("%s %s%s",tmp,_("is contacting you"), barmesg=ortp_strdup_printf("%s %s%s",tmp,_("is contacting you"),
(sal_call_autoanswer_asked(call->op)) ?_(" and asked autoanswer."):"."); (sal_call_autoanswer_asked(call->op)) ?_(" and asked autoanswer."):".");
linphone_core_notify_show_interface(lc); linphone_core_notify_show_interface(lc