mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
Fixed a leak
This commit is contained in:
parent
5ff8d1232f
commit
4561b0ce8c
2 changed files with 19 additions and 7 deletions
|
|
@ -96,6 +96,7 @@ static void linphone_carddav_vcards_pulled(LinphoneCardDavContext *cdc, MSList *
|
|||
LinphoneFriend *lf2 = (LinphoneFriend *)local_friend->data;
|
||||
if (cdc->contact_updated_cb) {
|
||||
ms_debug("Contact updated: %s", linphone_friend_get_name(lf));
|
||||
lf2 = linphone_friend_ref(lf2);
|
||||
cdc->contact_updated_cb(cdc, lf, lf2);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -107,7 +108,7 @@ static void linphone_carddav_vcards_pulled(LinphoneCardDavContext *cdc, MSList *
|
|||
}
|
||||
vCards = ms_list_next(vCards);
|
||||
}
|
||||
ms_list_free(localFriends);
|
||||
localFriends = ms_list_free_with_data(localFriends, (void (*)(void *))linphone_friend_unref);
|
||||
}
|
||||
ms_list_free(vCards);
|
||||
linphone_carddav_sync_done(cdc, TRUE, "");
|
||||
|
|
@ -174,8 +175,8 @@ static void linphone_carddav_vcards_fetched(LinphoneCardDavContext *cdc, MSList
|
|||
if (!vCard) {
|
||||
ms_debug("Local friend %s isn't in the remote vCard list, delete it", linphone_friend_get_name(lf));
|
||||
if (cdc->contact_removed_cb) {
|
||||
lf = linphone_friend_ref(lf);
|
||||
ms_debug("Contact removed: %s", linphone_friend_get_name(lf));
|
||||
lf = linphone_friend_ref(lf);
|
||||
cdc->contact_removed_cb(cdc, lf);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -186,13 +187,14 @@ static void linphone_carddav_vcards_fetched(LinphoneCardDavContext *cdc, MSList
|
|||
ms_debug("Local friend eTag is %s, remote vCard eTag is %s", linphone_vcard_get_etag(lvc), response->etag);
|
||||
if (lvc && strcmp(linphone_vcard_get_etag(lvc), response->etag) == 0) {
|
||||
ms_list_remove(vCards, vCard);
|
||||
ms_free(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
friends = ms_list_next(friends);
|
||||
}
|
||||
ms_list_free(localFriends);
|
||||
localFriends = ms_list_free_with_data(localFriends, (void (*)(void *))linphone_friend_unref);
|
||||
linphone_carddav_pull_vcards(cdc, vCards);
|
||||
}
|
||||
ms_list_free(vCards);
|
||||
|
|
|
|||
|
|
@ -194,31 +194,31 @@ typedef struct _LinphoneCardDAVStats {
|
|||
static void carddav_sync_done(LinphoneCardDavContext *c, bool_t success, const char *message) {
|
||||
LinphoneCardDAVStats *stats = (LinphoneCardDAVStats *)linphone_carddav_get_user_data(c);
|
||||
BC_ASSERT_TRUE(success);
|
||||
stats->sync_done_count++;
|
||||
linphone_carddav_destroy(c);
|
||||
stats->sync_done_count++;
|
||||
}
|
||||
|
||||
static void carddav_new_contact(LinphoneCardDavContext *c, LinphoneFriend *lf) {
|
||||
LinphoneCardDAVStats *stats = (LinphoneCardDAVStats *)linphone_carddav_get_user_data(c);
|
||||
BC_ASSERT_PTR_NOT_NULL_FATAL(lf);
|
||||
stats->new_contact_count++;
|
||||
linphone_friend_unref(lf);
|
||||
stats->new_contact_count++;
|
||||
}
|
||||
|
||||
static void carddav_removed_contact(LinphoneCardDavContext *c, LinphoneFriend *lf) {
|
||||
LinphoneCardDAVStats *stats = (LinphoneCardDAVStats *)linphone_carddav_get_user_data(c);
|
||||
BC_ASSERT_PTR_NOT_NULL_FATAL(lf);
|
||||
stats->removed_contact_count++;
|
||||
linphone_friend_unref(lf);
|
||||
stats->removed_contact_count++;
|
||||
}
|
||||
|
||||
static void carddav_updated_contact(LinphoneCardDavContext *c, LinphoneFriend *lf1, LinphoneFriend *lf2) {
|
||||
LinphoneCardDAVStats *stats = (LinphoneCardDAVStats *)linphone_carddav_get_user_data(c);
|
||||
BC_ASSERT_PTR_NOT_NULL_FATAL(lf1);
|
||||
BC_ASSERT_PTR_NOT_NULL_FATAL(lf2);
|
||||
stats->updated_contact_count++;
|
||||
linphone_friend_unref(lf1);
|
||||
linphone_friend_unref(lf2);
|
||||
stats->updated_contact_count++;
|
||||
}
|
||||
|
||||
static void carddav_sync(void) {
|
||||
|
|
@ -242,6 +242,8 @@ static void carddav_sync(void) {
|
|||
BC_ASSERT_EQUAL(stats->new_contact_count, 1, int, "%i");
|
||||
wait_for_until(manager->lc, NULL, &stats->sync_done_count, 1, 2000);
|
||||
BC_ASSERT_EQUAL(stats->sync_done_count, 1, int, "%i");
|
||||
|
||||
ms_free(stats);
|
||||
linphone_core_manager_destroy(manager);
|
||||
}
|
||||
|
||||
|
|
@ -276,6 +278,10 @@ static void carddav_sync_2(void) {
|
|||
BC_ASSERT_EQUAL(stats->removed_contact_count, 1, int, "%i");
|
||||
wait_for_until(manager->lc, NULL, &stats->sync_done_count, 1, 2000);
|
||||
BC_ASSERT_EQUAL(stats->sync_done_count, 1, int, "%i");
|
||||
|
||||
ms_free(stats);
|
||||
unlink(friends_db);
|
||||
ms_free(friends_db);
|
||||
linphone_core_manager_destroy(manager);
|
||||
}
|
||||
|
||||
|
|
@ -309,6 +315,10 @@ static void carddav_sync_3(void) {
|
|||
BC_ASSERT_EQUAL(stats->updated_contact_count, 1, int, "%i");
|
||||
wait_for_until(manager->lc, NULL, &stats->sync_done_count, 1, 2000);
|
||||
BC_ASSERT_EQUAL(stats->sync_done_count, 1, int, "%i");
|
||||
|
||||
ms_free(stats);
|
||||
unlink(friends_db);
|
||||
ms_free(friends_db);
|
||||
linphone_core_manager_destroy(manager);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue