Commit d4582582 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩
Browse files

Fixed segfault when manipulating friends with vcards without carddav configured

parent 0676eaf4
...@@ -451,11 +451,13 @@ static LinphoneFriendListStatus _linphone_friend_list_remove_friend(LinphoneFrie ...@@ -451,11 +451,13 @@ static LinphoneFriendListStatus _linphone_friend_list_remove_friend(LinphoneFrie
LinphoneVCard *lvc = linphone_friend_get_vcard(lf); LinphoneVCard *lvc = linphone_friend_get_vcard(lf);
if (lvc && linphone_vcard_get_uid(lvc)) { if (lvc && linphone_vcard_get_uid(lvc)) {
LinphoneCardDavContext *cdc = linphone_carddav_context_new(list); LinphoneCardDavContext *cdc = linphone_carddav_context_new(list);
cdc->sync_done_cb = carddav_done; if (cdc) {
if (cdc->friend_list->cbs->sync_state_changed_cb) { cdc->sync_done_cb = carddav_done;
cdc->friend_list->cbs->sync_state_changed_cb(cdc->friend_list, LinphoneFriendListSyncStarted, NULL); 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);
} }
} }
......
...@@ -120,11 +120,7 @@ static void friends_migration(void) { ...@@ -120,11 +120,7 @@ static void friends_migration(void) {
BC_ASSERT_EQUAL(ms_list_size(friends), 3, int, "%d"); BC_ASSERT_EQUAL(ms_list_size(friends), 3, int, "%d");
friends_from_db = linphone_core_fetch_friends_from_db(manager->lc, lfl); friends_from_db = linphone_core_fetch_friends_from_db(manager->lc, lfl);
BC_ASSERT_EQUAL(ms_list_size(friends_from_db), 3, int, "%d"); 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); friends_from_db = ms_list_free_with_data(friends_from_db, (void (*)(void *))linphone_friend_unref);
unlink(friends_db); unlink(friends_db);
ms_free(friends_db); ms_free(friends_db);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment