From c41132f31dd89c082c0f8bb49311634459471bd3 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 8 Jan 2018 15:05:47 +0100 Subject: [PATCH] Fix memory leak with c-wrapper for calls. --- coreapi/linphonecore.c | 2 +- src/c-wrapper/api/c-core.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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); }