diff --git a/coreapi/authentication.c b/coreapi/authentication.c index 24bed1c43..b41b0d70b 100644 --- a/coreapi/authentication.c +++ b/coreapi/authentication.c @@ -246,6 +246,7 @@ void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info) { LinphoneAuthInfo *ai; MSList *elem; + MSList *l; /* find if we are attempting to modify an existing auth info */ ai=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,info->realm,info->username); @@ -255,7 +256,7 @@ void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info) } lc->auth_info=ms_list_append(lc->auth_info,linphone_auth_info_clone(info)); /* retry pending authentication operations */ - for(elem=sal_get_pending_auths(lc->sal);elem!=NULL;elem=elem->next){ + for(l=elem=sal_get_pending_auths(lc->sal);elem!=NULL;elem=elem->next){ const char *username,*realm; SalOp *op=(SalOp*)elem->data; LinphoneAuthInfo *ai; @@ -271,6 +272,7 @@ void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info) ai->usecount++; } } + ms_list_free(l); } diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index a0622226c..33ef079c9 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -1177,10 +1177,14 @@ static bool_t process_authentication(Sal *sal, eXosip_event_t *ev){ return TRUE; } if (get_auth_data(ev,&realm,&username)==0){ - if (op->pending_auth!=NULL) + if (op->pending_auth!=NULL){ eXosip_event_free(op->pending_auth); - op->pending_auth=ev; - sal_add_pending_auth (sal,op); + op->pending_auth=ev; + }else{ + op->pending_auth=ev; + sal_add_pending_auth(sal,op); + } + sal->callbacks.auth_requested(op,realm,username); return FALSE; }