diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 4a9845196..8a0c45e02 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3728,7 +3728,7 @@ LinphoneStatus linphone_core_decline_call(LinphoneCore *lc, LinphoneCall *call, const bctbx_list_t *linphone_core_get_calls(LinphoneCore *lc) { if (lc->callsCache) { - bctbx_list_free(lc->callsCache); + bctbx_list_free_with_data(lc->callsCache, (bctbx_list_free_func)linphone_call_unref); lc->callsCache = NULL; } lc->callsCache = L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(L_GET_CPP_PTR_FROM_C_OBJECT(lc)->getCalls()); diff --git a/src/c-wrapper/api/c-core.cpp b/src/c-wrapper/api/c-core.cpp index 54e42d7c2..627b2dc64 100644 --- a/src/c-wrapper/api/c-core.cpp +++ b/src/c-wrapper/api/c-core.cpp @@ -42,6 +42,6 @@ static void _linphone_core_constructor (LinphoneCore *lc) { static void _linphone_core_destructor (LinphoneCore *lc) { if (lc->callsCache) - bctbx_list_free(lc->callsCache); + bctbx_list_free_with_data(lc->callsCache, (bctbx_list_free_func)linphone_call_unref); _linphone_core_uninit(lc); }