]> sjero.net Git - linphone/commitdiff
fix several memory leaks.
authorSimon Morlat <simon.morlat@linphone.org>
Thu, 25 Mar 2010 15:23:26 +0000 (16:23 +0100)
committerSimon Morlat <simon.morlat@linphone.org>
Thu, 25 Mar 2010 15:23:26 +0000 (16:23 +0100)
coreapi/linphonecore.c
coreapi/presence.c
coreapi/sal_eXosip2.c

index 65b11d3c354968c948dcbf7818841bb355884bf6..dbdd77c26e58ea0089f0e2c43d3bcf1fcac78367 100644 (file)
@@ -661,6 +661,7 @@ static void sip_config_read(LinphoneCore *lc)
                LinphoneAuthInfo *ai=linphone_auth_info_new_from_config_file(lc->config,i);
                if (ai!=NULL){
                        linphone_core_add_auth_info(lc,ai);
+                       linphone_auth_info_destroy(ai);
                }else{
                        break;
                }
@@ -3242,14 +3243,16 @@ void net_config_uninit(LinphoneCore *lc)
        lp_config_set_int(lc->config,"net","download_bw",config->download_bw);
        lp_config_set_int(lc->config,"net","upload_bw",config->upload_bw);
 
-       if (config->stun_server!=NULL)
+       if (config->stun_server!=NULL){
                lp_config_set_string(lc->config,"net","stun_server",config->stun_server);
-       if (config->nat_address!=NULL)
+               ms_free(lc->net_conf.stun_server);
+       }
+       if (config->nat_address!=NULL){
                lp_config_set_string(lc->config,"net","nat_address",config->nat_address);
+               ms_free(lc->net_conf.nat_address);
+       }
        lp_config_set_int(lc->config,"net","firewall_policy",config->firewall_policy);
-       lp_config_set_int(lc->config,"net","mtu",config->mtu);
-       if (lc->net_conf.stun_server!=NULL)
-               ms_free(lc->net_conf.stun_server);
+       lp_config_set_int(lc->config,"net","mtu",config->mtu);  
 }
 
 
@@ -3301,8 +3304,15 @@ void sip_config_uninit(LinphoneCore *lc)
        ms_list_for_each(lc->auth_info,(void (*)(void*))linphone_auth_info_destroy);
        ms_list_free(lc->auth_info);
        lc->auth_info=NULL;
+       
        sal_uninit(lc->sal);
        lc->sal=NULL;
+
+       if (lc->sip_conf.guessed_contact)
+               ms_free(lc->sip_conf.guessed_contact);
+       if (config->contact)
+               ms_free(config->contact);
+       
 }
 
 void rtp_config_uninit(LinphoneCore *lc)
@@ -3335,6 +3345,8 @@ void video_config_uninit(LinphoneCore *lc)
        lp_config_set_int(lc->config,"video","capture",lc->video_conf.capture);
        lp_config_set_int(lc->config,"video","show_local",linphone_core_video_preview_enabled(lc));
        lp_config_set_int(lc->config,"video","self_view",linphone_core_self_view_enabled(lc));
+       if (lc->video_conf.cams)
+               ms_free(lc->video_conf.cams);
 }
 
 void codecs_config_uninit(LinphoneCore *lc)
@@ -3363,6 +3375,8 @@ void codecs_config_uninit(LinphoneCore *lc)
                lp_config_set_string(lc->config,key,"recv_fmtp",pt->recv_fmtp);
                index++;
        }
+       ms_list_free(lc->codecs_conf.audio_codecs);
+       ms_list_free(lc->codecs_conf.video_codecs);
 }
 
 void ui_config_uninit(LinphoneCore* lc)
@@ -3422,6 +3436,9 @@ static void linphone_core_uninit(LinphoneCore *lc)
        lc->config = NULL; /* Mark the config as NULL to block further calls */
        sip_setup_unregister_all();
 
+       ms_list_for_each(lc->call_logs,(void (*)(void*))linphone_call_log_destroy);
+       lc->call_logs=ms_list_free(lc->call_logs);
+
        linphone_core_free_payload_types();
 
        ortp_exit();
index aa3c17bd20f158524464a7bc5d923f3aea02b827..4367130d5e605da284bda1046c56711ed928458a 100644 (file)
@@ -84,6 +84,7 @@ void linphone_subscription_new(LinphoneCore *lc, SalOp *op, const char *from){
                        linphone_core_add_subscriber(lc,tmp,op);
                }
        }
+       linphone_address_destroy(uri);
        ms_free(tmp);
 }
 
index 38ba14c91922d51a60277642016a598b0de38775..d4ce598a387d9aedf9124efbea372e3d60fe8471 100644 (file)
@@ -1204,6 +1204,7 @@ static bool_t register_again_with_updated_contact(SalOp *op, osip_message_t *ori
        sal_address_clean(addr);
        tmp=sal_address_as_string(addr);
        sal_op_set_contact(op,tmp);
+       sal_address_destroy(addr);
        ms_message("Resending new register with updated contact %s",tmp);
        ms_free(tmp);
        return TRUE;