From b076a58a3aad88b63e9195148b5116389c3bad36 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Fri, 7 Nov 2014 15:20:14 +0100 Subject: [PATCH] Fix major leak on call creation (a whole picture leaked on each outgoing call is not good...) --- Classes/LinphoneManager.m | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 8ec20af7a..5947c6498 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -1845,9 +1845,14 @@ static void audioRouteChangeListenerCallback ( linphone_address_destroy(linphoneAddress); } if (call) { - LinphoneCallAppData* data = [[LinphoneCallAppData alloc] init]; - data->videoRequested = linphone_call_params_video_enabled(lcallParams); /* will be used later to notify user if video was not activated because of the linphone core*/ - linphone_call_set_user_pointer(call, data); + // The LinphoneCallAppData object should be set on call creation with callback + // - (void)onCall:StateChanged:withMessage:. If not, we are in big trouble and expect it to crash + // We are NOT responsible for creating the AppData. + LinphoneCallAppData* data=(LinphoneCallAppData*)linphone_call_get_user_pointer(call); + if (data==nil) + [LinphoneLogger log:LinphoneLoggerError format:@"New call instanciated but app data was not set. Expect it to crash."]; + /* will be used later to notify user if video was not activated because of the linphone core*/ + data->videoRequested = linphone_call_params_video_enabled(lcallParams); } linphone_call_params_destroy(lcallParams); }