Commit 7dc834b2 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Fix malloc/free mismatches in tester.

parent 83ad9553
......@@ -1989,8 +1989,12 @@ void video_call_base_2(LinphoneCoreManager* caller,LinphoneCoreManager* callee,
linphone_core_enable_video_capture(caller->lc, caller_video_enabled);
if (mode==LinphoneMediaEncryptionDTLS) { /* for DTLS we must access certificates or at least have a directory to store them */
callee->lc->user_certificates_path = bc_tester_file("certificates-marie");
caller->lc->user_certificates_path = bc_tester_file("certificates-pauline");
const char *path = bc_tester_file("certificates-marie");
callee->lc->user_certificates_path = ms_strdup(path);
bc_free(path);
path = bc_tester_file("certificates-pauline");
caller->lc->user_certificates_path = ms_strdup(path);
bc_free(path);
belle_sip_mkdir(callee->lc->user_certificates_path);
belle_sip_mkdir(caller->lc->user_certificates_path);
}
......@@ -2097,8 +2101,12 @@ void video_call_base_3(LinphoneCoreManager* caller,LinphoneCoreManager* callee,
linphone_core_enable_video_capture(caller->lc, caller_video_enabled);
if (mode==LinphoneMediaEncryptionDTLS) { /* for DTLS we must access certificates or at least have a directory to store them */
callee->lc->user_certificates_path = bc_tester_file("certificates-marie");
caller->lc->user_certificates_path = bc_tester_file("certificates-pauline");
const char *path = bc_tester_file("certificates-marie");
callee->lc->user_certificates_path = ms_strdup(path);
bc_free(path);
path = bc_tester_file("certificates-pauline");
caller->lc->user_certificates_path = ms_strdup(path);
bc_free(path);
belle_sip_mkdir(callee->lc->user_certificates_path);
belle_sip_mkdir(caller->lc->user_certificates_path);
}
......@@ -2936,8 +2944,12 @@ void call_base_with_configfile(LinphoneMediaEncryption mode, bool_t enable_video
linphone_core_set_media_encryption(marie->lc,mode);
linphone_core_set_media_encryption(pauline->lc,mode);
if (mode==LinphoneMediaEncryptionDTLS) { /* for DTLS we must access certificates or at least have a directory to store them */
marie->lc->user_certificates_path = bc_tester_file("certificates-marie");
pauline->lc->user_certificates_path = bc_tester_file("certificates-pauline");
const char *path = bc_tester_file("certificates-marie");
marie->lc->user_certificates_path = ms_strdup(path);
bc_free(path);
path = bc_tester_file("certificates-pauline");
pauline->lc->user_certificates_path = ms_strdup(path);
bc_free(path);
belle_sip_mkdir(marie->lc->user_certificates_path);
belle_sip_mkdir(pauline->lc->user_certificates_path);
}
......@@ -4373,7 +4385,7 @@ static void call_with_generic_cn(void) {
linphone_core_manager_destroy(pauline);
ms_free(audio_file_with_silence);
ms_free(recorded_file);
bc_free(recorded_file);
}
void static call_state_changed_2(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *msg){
LCSipTransports sip_tr;
......@@ -4736,7 +4748,7 @@ end:
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
ms_free(stereo_file);
ms_free(recordpath);
bc_free(recordpath);
}
static void simple_stereo_call_l16(void){
......
......@@ -656,6 +656,10 @@ char* bc_sprintf(const char* format, ...) {
return res;
}
void bc_free(void *ptr) {
free(ptr);
}
const char * bc_tester_current_suite_name(void) {
return bc_current_suite_name;
}
......
......@@ -97,6 +97,7 @@ const char * bc_tester_current_test_name(void);
char* bc_sprintfva(const char* format, va_list args);
char* bc_sprintf(const char* format, ...);
void bc_free(void *ptr);
/**
* Get full path to the given resource
......
......@@ -791,7 +791,7 @@ static void file_transfer_message_rcs_to_external_body_client(void) {
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
ms_free(send_filepath);
ms_free(receive_filepath);
bc_free(receive_filepath);
}
}
......
......@@ -72,7 +72,7 @@ void file_transfer_received(LinphoneChatMessage *msg, const LinphoneContent* con
file = fopen(receive_file,"wb");
linphone_chat_message_set_user_data(msg,(void*)file); /*store fd for next chunks*/
}
ms_free(receive_file);
bc_free(receive_file);
file = (FILE*)linphone_chat_message_get_user_data(msg);
BC_ASSERT_PTR_NOT_NULL(file);
if (linphone_buffer_is_empty(buffer)) { /* tranfer complete */
......@@ -456,7 +456,7 @@ void transfer_message_base2(LinphoneCoreManager* marie, LinphoneCoreManager* pau
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,1, int, "%d");
}
ms_free(send_filepath);
ms_free(receive_filepath);
bc_free(receive_filepath);
}
void transfer_message_base(bool_t upload_error, bool_t download_error) {
......@@ -642,7 +642,7 @@ static void file_transfer_2_messages_simultaneously(void) {
}
linphone_core_manager_destroy(pauline);
ms_free(send_filepath);
ms_free(receive_filepath);
bc_free(receive_filepath);
linphone_core_manager_destroy(marie);
}
}
......@@ -758,7 +758,7 @@ static void is_composing_notification(void) {
static FILE* fopen_from_write_dir(const char * name, const char * mode) {
char *filepath = bc_tester_file(name);
FILE * file = fopen(filepath,mode);
ms_free(filepath);
bc_free(filepath);
return file;
}
......@@ -783,11 +783,11 @@ static void lime_text_message(void) {
filepath = bc_tester_file("tmpZIDCacheMarie.xml");
linphone_core_set_zrtp_secrets_file(marie->lc, filepath);
ms_free(filepath);
bc_free(filepath);
filepath = bc_tester_file("tmpZIDCachePauline.xml");
linphone_core_set_zrtp_secrets_file(pauline->lc, filepath);
ms_free(filepath);
bc_free(filepath);
chat_room = linphone_core_get_chat_room(pauline->lc, marie->identity);
......@@ -820,7 +820,7 @@ static void lime_text_message_to_non_lime(void) {
filepath = bc_tester_file("tmpZIDCachePauline.xml");
linphone_core_set_zrtp_secrets_file(pauline->lc, filepath);
ms_free(filepath);
bc_free(filepath);
chat_room = linphone_core_get_chat_room(pauline->lc, marie->identity);
......@@ -866,11 +866,11 @@ void lime_transfer_message_base(bool_t encrypt_file) {
filepath = bc_tester_file("tmpZIDCacheMarie.xml");
linphone_core_set_zrtp_secrets_file(marie->lc, filepath);
ms_free(filepath);
bc_free(filepath);
filepath = bc_tester_file("tmpZIDCachePauline.xml");
linphone_core_set_zrtp_secrets_file(pauline->lc, filepath);
ms_free(filepath);
bc_free(filepath);
/* Globally configure an http file transfer server. */
linphone_core_set_file_transfer_server(pauline->lc,"https://www.linphone.org:444/lft.php");
......@@ -1172,7 +1172,7 @@ static void database_migration(void) {
linphone_core_manager_destroy(marie);
remove(tmp_db);
ms_free(src_db);
ms_free(tmp_db);
bc_free(tmp_db);
}
static void history_range(void){
......@@ -1212,7 +1212,7 @@ static void history_range(void){
linphone_address_destroy(jehan_addr);
remove(tmp_db);
ms_free(src_db);
ms_free(tmp_db);
bc_free(tmp_db);
}
static void history_count(void) {
......@@ -1270,7 +1270,7 @@ static void history_count(void) {
linphone_address_destroy(jehan_addr);
remove(tmp_db);
ms_free(src_db);
ms_free(tmp_db);
bc_free(tmp_db);
}
#endif
......
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