]> sjero.net Git - linphone/commitdiff
fix potential double free in error cases, and optimize clearing of proxy configs
authorSimon Morlat <simon.morlat@linphone.org>
Tue, 14 Feb 2012 08:50:16 +0000 (09:50 +0100)
committerSimon Morlat <simon.morlat@linphone.org>
Tue, 14 Feb 2012 08:50:16 +0000 (09:50 +0100)
coreapi/linphonecore.c
coreapi/proxy.c
mediastreamer2
oRTP

index ebdb615de46e78573c0202f5efe018af89a5004b..4fd6c6ae5513626d6eeb24cf0a650e474bcf601b 100644 (file)
@@ -1630,18 +1630,17 @@ static void monitor_network_state(LinphoneCore *lc, time_t curtime){
 }
 
 static void proxy_update(LinphoneCore *lc){
+       MSList *elem,*next;
        ms_list_for_each(lc->sip_conf.proxies,(void (*)(void*))&linphone_proxy_config_update);
-       MSList* list=ms_list_copy(lc->sip_conf.deleted_proxies);
-       MSList* copy=list;
-       for(;list!=NULL;list=list->next){
-               LinphoneProxyConfig* cfg = (LinphoneProxyConfig*) list->data;
+       for(elem=lc->sip_conf.deleted_proxies;elem!=NULL;elem=next){
+               LinphoneProxyConfig* cfg = (LinphoneProxyConfig*)elem->data;
+               next=elem->next;
                if (ms_time(NULL) - cfg->deletion_date > 5) {
-                       lc->sip_conf.deleted_proxies =ms_list_remove(lc->sip_conf.deleted_proxies,(void *)cfg);
+                       lc->sip_conf.deleted_proxies =ms_list_remove_link(lc->sip_conf.deleted_proxies,elem);
                        ms_message("clearing proxy config for [%s]",linphone_proxy_config_get_addr(cfg));
                        linphone_proxy_config_destroy(cfg);
                }
        }
-       ms_list_free(copy);
 }
 
 static void assign_buddy_info(LinphoneCore *lc, BuddyInfo *info){
index 10400f5d2aabeac322f038b0d7c01abd86c375d7..c708dcf40884a555eb8ff85065295542e5b75594 100644 (file)
@@ -516,11 +516,9 @@ struct _LinphoneCore * linphone_proxy_config_get_core(const LinphoneProxyConfig
 **/
 int linphone_core_add_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *cfg){
        if (!linphone_proxy_config_check(lc,cfg)) {
-               linphone_proxy_config_destroy(cfg);
                return -1;
        }
        if (ms_list_find(lc->sip_conf.proxies,cfg)!=NULL){
-               linphone_proxy_config_destroy(cfg);
                ms_warning("ProxyConfig already entered, ignored.");
                return 0;
        }
index b6cc1a559e5730321974fa88b6d3e35cf91e1d31..e25eb6683a0ae9933b59eb9023424e2333c5d236 160000 (submodule)
@@ -1 +1 @@
-Subproject commit b6cc1a559e5730321974fa88b6d3e35cf91e1d31
+Subproject commit e25eb6683a0ae9933b59eb9023424e2333c5d236
diff --git a/oRTP b/oRTP
index a936749fac4d3e2f788a0c03b3c4ea2021b3ae13..177467aba0365f1903ec94663d4ebcc1103be336 160000 (submodule)
--- a/oRTP
+++ b/oRTP
@@ -1 +1 @@
-Subproject commit a936749fac4d3e2f788a0c03b3c4ea2021b3ae13
+Subproject commit 177467aba0365f1903ec94663d4ebcc1103be336