Fixed segfault when manipulating friends with vcards without carddav configured

This commit is contained in:
Sylvain Berfini 2016-02-03 15:26:07 +01:00
parent 0676eaf4f1
commit d458258237
2 changed files with 6 additions and 8 deletions

View file

@ -451,11 +451,13 @@ static LinphoneFriendListStatus _linphone_friend_list_remove_friend(LinphoneFrie
LinphoneVCard *lvc = linphone_friend_get_vcard(lf);
if (lvc && linphone_vcard_get_uid(lvc)) {
LinphoneCardDavContext *cdc = linphone_carddav_context_new(list);
cdc->sync_done_cb = carddav_done;
if (cdc->friend_list->cbs->sync_state_changed_cb) {
cdc->friend_list->cbs->sync_state_changed_cb(cdc->friend_list, LinphoneFriendListSyncStarted, NULL);
if (cdc) {
cdc->sync_done_cb = carddav_done;
if (cdc->friend_list->cbs->sync_state_changed_cb) {
cdc->friend_list->cbs->sync_state_changed_cb(cdc->friend_list, LinphoneFriendListSyncStarted, NULL);
}
linphone_carddav_delete_vcard(cdc, lf);
}
linphone_carddav_delete_vcard(cdc, lf);
}
}

View file

@ -120,11 +120,7 @@ static void friends_migration(void) {
BC_ASSERT_EQUAL(ms_list_size(friends), 3, int, "%d");
friends_from_db = linphone_core_fetch_friends_from_db(manager->lc, lfl);
BC_ASSERT_EQUAL(ms_list_size(friends_from_db), 3, int, "%d");
if (ms_list_size(friends_from_db) < 3) {
goto end;
}
end:
friends_from_db = ms_list_free_with_data(friends_from_db, (void (*)(void *))linphone_friend_unref);
unlink(friends_db);
ms_free(friends_db);