From df58cddb5d09bba69802ee33aee5385607fd1a68 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 17 Sep 2014 13:21:57 +0200 Subject: [PATCH] clean proxy config in linphone_core_destroy() --- coreapi/linphonecore.c | 8 ++------ coreapi/private.h | 1 + coreapi/proxy.c | 5 +++++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 9f21533ee..6ddad4201 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -5521,15 +5521,11 @@ void sip_config_uninit(LinphoneCore *lc) } if (i>=20) ms_warning("Cannot complete unregistration, giving up"); } - ms_list_for_each(config->proxies,(void (*)(void*)) linphone_proxy_config_destroy); - ms_list_free(config->proxies); - config->proxies=NULL; + config->proxies=ms_list_free_with_data(config->proxies,(void (*)(void*)) _linphone_proxy_config_release); /*no longuer need to write proxy config if not changedlinphone_proxy_config_write_to_config_file(lc->config,NULL,i);*/ /*mark the end */ - ms_list_for_each(lc->auth_info,(void (*)(void*))linphone_auth_info_destroy); - ms_list_free(lc->auth_info); - lc->auth_info=NULL; + lc->auth_info=ms_list_free_with_data(lc->auth_info,(void (*)(void*))linphone_auth_info_destroy); /*now that we are unregisted, we no longer need the tunnel.*/ #ifdef TUNNEL_ENABLED diff --git a/coreapi/private.h b/coreapi/private.h index 4977f196c..afd6b9509 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -300,6 +300,7 @@ int linphone_proxy_config_send_publish(LinphoneProxyConfig *cfg, LinphonePresenc void linphone_proxy_config_set_state(LinphoneProxyConfig *cfg, LinphoneRegistrationState rstate, const char *message); void linphone_proxy_config_stop_refreshing(LinphoneProxyConfig *obj); void linphone_proxy_config_write_all_to_config_file(LinphoneCore *lc); +void _linphone_proxy_config_release(LinphoneProxyConfig *cfg); /* * returns service route as defined in as defined by rfc3608, might be a list instead of just one. * Can be NULL diff --git a/coreapi/proxy.c b/coreapi/proxy.c index 60bcabde6..f79b253ee 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -188,6 +188,11 @@ void linphone_proxy_config_destroy(LinphoneProxyConfig *cfg) { belle_sip_object_unref(cfg); } +void _linphone_proxy_config_release(LinphoneProxyConfig *cfg) { + _linphone_proxy_config_release_ops(cfg); + belle_sip_object_unref(cfg); +} + LinphoneProxyConfig *linphone_proxy_config_ref(LinphoneProxyConfig *cfg) { belle_sip_object_ref(cfg); return cfg;