Commit 272d1ac8 authored by Simon Morlat's avatar Simon Morlat
Browse files

fix memory leaks

reuse same sip.instance in account manager of tester
parent 330a4ca9
......@@ -220,12 +220,14 @@ void sal_process_incoming_message(SalOp *op,const belle_sip_request_event_t *eve
resp = belle_sip_response_create_from_request(req,415);
add_message_accept((belle_sip_message_t*)resp);
belle_sip_server_transaction_send_response(server_transaction,resp);
sal_op_release(op);
return;
}
return;
error:
resp = belle_sip_response_create_from_request(req, errcode);
belle_sip_server_transaction_send_response(server_transaction,resp);
sal_op_release(op);
}
static void process_request_event(void *op_base, const belle_sip_request_event_t *event) {
......
......@@ -1492,7 +1492,7 @@ static void misc_config_read(LinphoneCore *lc) {
LpConfig *config=lc->config;
const char *uuid;
lc->max_call_logs=lp_config_get_int(config,"misc","history_max_size",15);
lc->max_call_logs=lp_config_get_int(config,"misc","history_max_size",30);
lc->max_calls=lp_config_get_int(config,"misc","max_calls",NB_MAX_CALLS);
uuid=lp_config_get_string(config,"misc","uuid",NULL);
......
......@@ -23,6 +23,7 @@ struct _Account{
LinphoneAddress *identity;
LinphoneAddress *modified_identity;
char *password;
char *instance_id;
int created;
int done;
int auth_requested;
......@@ -49,6 +50,7 @@ Account *account_new(LinphoneAddress *identity, const char *unique_id){
void account_destroy(Account *obj){
linphone_address_unref(obj->identity);
linphone_address_unref(obj->modified_identity);
ms_free(obj->instance_id);
ms_free(obj->password);
ms_free(obj);
}
......@@ -124,6 +126,7 @@ void account_create_on_server(Account *account, const LinphoneProxyConfig *refcf
vtable.registration_state_changed=account_created_on_server_cb;
vtable.auth_info_requested=account_created_auth_requested_cb;
lc=configure_lc_from(&vtable,liblinphone_tester_file_prefix,NULL,account);
account->instance_id = ms_strdup(lp_config_get_string(lc->config,"misc","uuid",NULL));
tr.udp_port=LC_SIP_TRANSPORT_RANDOM;
tr.tcp_port=LC_SIP_TRANSPORT_RANDOM;
tr.tls_port=LC_SIP_TRANSPORT_RANDOM;
......@@ -202,7 +205,9 @@ LinphoneAddress *account_manager_check_account(AccountManager *m, LinphoneProxyC
if (create_account){
account_create_on_server(account,cfg);
lp_config_set_string(lc->config, "misc", "uuid", account->instance_id);
}
sal_set_uuid(lc->sal, account->instance_id);
ai=linphone_auth_info_new(linphone_address_get_username(account->modified_identity),
NULL,
account->password,NULL,NULL,linphone_address_get_domain(account->modified_identity));
......
......@@ -167,6 +167,7 @@ typedef struct _stats {
int number_of_LinphoneMessageInProgress;
int number_of_LinphoneMessageDelivered;
int number_of_LinphoneMessageNotDelivered;
int number_of_LinphoneMessageFileTransferDone;
int number_of_LinphoneIsComposingActiveReceived;
int number_of_LinphoneIsComposingIdleReceived;
int progress_of_LinphoneFileTransfer;
......
......@@ -162,21 +162,25 @@ void liblinphone_tester_chat_message_msg_state_changed(LinphoneChatMessage *msg,
if (!text) text = "<no text>";
ms_message("Message [%s] [%s]",text, linphone_chat_message_state_to_string(state));
switch (state) {
case LinphoneChatMessageStateDelivered:
counters->number_of_LinphoneMessageDelivered++;
break;
case LinphoneChatMessageStateNotDelivered:
counters->number_of_LinphoneMessageNotDelivered++;
break;
case LinphoneChatMessageStateInProgress:
counters->number_of_LinphoneMessageInProgress++;
break;
case LinphoneChatMessageStateFileTransferError:
counters->number_of_LinphoneMessageNotDelivered++;
break;
default:
ms_error("Unexpected state [%s] for message [%p]",linphone_chat_message_state_to_string(state), msg);
case LinphoneChatMessageStateIdle:
return;
case LinphoneChatMessageStateDelivered:
counters->number_of_LinphoneMessageDelivered++;
return;
case LinphoneChatMessageStateNotDelivered:
counters->number_of_LinphoneMessageNotDelivered++;
return;
case LinphoneChatMessageStateInProgress:
counters->number_of_LinphoneMessageInProgress++;
return;
case LinphoneChatMessageStateFileTransferError:
counters->number_of_LinphoneMessageNotDelivered++;
return;
case LinphoneChatMessageStateFileTransferDone:
counters->number_of_LinphoneMessageFileTransferDone++;
return;
}
ms_error("Unexpected state [%s] for message [%p]",linphone_chat_message_state_to_string(state), msg);
}
static void text_message(void) {
......@@ -389,11 +393,11 @@ static void text_message_with_ack(void) {
static void text_message_with_external_body(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
char *to = linphone_address_as_string(marie->identity);
LinphoneChatRoom* chat_room = linphone_core_create_chat_room(pauline->lc,to);
LinphoneChatMessage* message = linphone_chat_room_create_message(chat_room,"Bli bli bli \n blu");
LinphoneChatMessageCbs *cbs = linphone_chat_message_get_callbacks(message);
linphone_chat_message_set_external_body_url(message,message_external_body_url="http://www.linphone.org");
{
......@@ -601,7 +605,7 @@ static void lime_file_transfer_message(void) {
ZIDCachePaulineFD = fopen("tmpZIDCachePauline.xml", "wb");
pauline_id = linphone_address_as_string_uri_only(pauline->identity);
marie_id = linphone_address_as_string_uri_only(marie->identity);
fprintf(ZIDCacheMarieFD, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<cache><selfZID>ef7692d0792a67491ae2d44e</selfZID><peer><ZID>005dbe0399643d953a2202dd</ZID><rs1>9b5c8f06f3b6c2c695f2dfc3c26f31f5fef8661f8c5fe7c95aeb5c5b0435b045</rs1><aux>f8324dd18ea905171ec2be89f879d01d5994132048d92ea020778cbdf31c605e</aux><rs2>2fdcef69380937c2cf221f7d11526f286c39f49641452ba9012521c705094899</rs2><uri>%s</uri><sndKey>08df5907d30959b8cb70f6fff2d8febd88fb41b0c8afc39e4b972f86dd5cfe2d</sndKey><rcvKey>60f020a3fe11dc2cc0e1e8ed9341b4cd14944db806ca4fc95456bbe45d95c43a</rcvKey><sndSId>5f9aa1e5e4c7ec88fa389a9f6b8879b42d3c57bb28e62068d2df23e8f9b77193</sndSId><rcvSId>bcffd51e7316a6c6f53a50fcf01b01bf2d3c57bb28e62068d2df23e8f9b77193</rcvSId><sndIndex>00000078</sndIndex><rcvIndex>000001cf</rcvIndex><pvs>01</pvs></peer><peer><ZID>1234567889643d953a2202ee</ZID><rs1>9b5c8f06f3b6c2c695f2dfc3c26f31f5fef8661f8c5fe7c95aeb5c5b0435b045</rs1><aux>f8324dd18ea905171ec2be89f879d01d5994132048d92ea020778cbdf31c605e</aux><rs2>2fdcef69380937c2cf221f7d11526f286c39f49641452ba9012521c705094899</rs2><uri>%s</uri><sndKey>72d80ab1cad243cf45634980c1d02cfb2df81ce0dd5dfcf1ebeacfc5345a9176</sndKey><rcvKey>25d9ac653a83c4559cb0ae7394e7cd3b2d3c57bb28e62068d2df23e8f9b77193</rcvKey><sndSId>f69aa1e5e4c7ec88fa389a9f6b8879b42d3c57bb28e62068d2df23e8f9b77193</sndSId><rcvSId>22ffd51e7316a6c6f53a50fcf01b01bf2d3c57bb28e62068d2df23e8f9b77193</rcvSId><sndIndex>0000000f</sndIndex><rcvIndex>00000000</rcvIndex></peer></cache>", pauline_id, pauline_id);
fprintf(ZIDCacheMarieFD, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<cache><selfZID>ef7692d0792a67491ae2d44e</selfZID><peer><ZID>005dbe0399643d953a2202dd</ZID><rs1>9b5c8f06f3b6c2c695f2dfc3c26f31f5fef8661f8c5fe7c95aeb5c5b0435b045</rs1><aux>f8324dd18ea905171ec2be89f879d01d5994132048d92ea020778cbdf31c605e</aux><rs2>2fdcef69380937c2cf221f7d11526f286c39f49641452ba9012521c705094899</rs2><uri>%s</uri><sndKey>08df5907d30959b8cb70f6fff2d8febd88fb41b0c8afc39e4b972f86dd5cfe2d</sndKey><rcvKey>60f020a3fe11dc2cc0e1e8ed9341b4cd14944db806ca4fc95456bbe45d95c43a</rcvKey><sndSId>5f9aa1e5e4c7ec88fa389a9f6b8879b42d3c57bb28e62068d2df23e8f9b77193</sndSId><rcvSId>bcffd51e7316a6c6f53a50fcf01b01bf2d3c57bb28e62068d2df23e8f9b77193</rcvSId><sndIndex>00000078</sndIndex><rcvIndex>000001cf</rcvIndex><pvs>01</pvs></peer><peer><ZID>1234567889643d953a2202ee</ZID><rs1>9b5c8f06f3b6c2c695f2dfc3c26f31f5fef8661f8c5fe7c95aeb5c5b0435b045</rs1><aux>f8324dd18ea905171ec2be89f879d01d5994132048d92ea020778csal_set_uuid(lc->sal, account->instance_id);bdf31c605e</aux><rs2>2fdcef69380937c2cf221f7d11526f286c39f49641452ba9012521c705094899</rs2><uri>%s</uri><sndKey>72d80ab1cad243cf45634980c1d02cfb2df81ce0dd5dfcf1ebeacfc5345a9176</sndKey><rcvKey>25d9ac653a83c4559cb0ae7394e7cd3b2d3c57bb28e62068d2df23e8f9b77193</rcvKey><sndSId>f69aa1e5e4c7ec88fa389a9f6b8879b42d3c57bb28e62068d2df23e8f9b77193</sndSId><rcvSId>22ffd51e7316a6c6f53a50fcf01b01bf2d3c57bb28e62068d2df23e8f9b77193</rcvSId><sndIndex>0000000f</sndIndex><rcvIndex>00000000</rcvIndex></peer></cache>", pauline_id, pauline_id);
fprintf(ZIDCachePaulineFD, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<cache><selfZID>005dbe0399643d953a2202dd</selfZID><peer><ZID>ef7692d0792a67491ae2d44e</ZID><rs1>9b5c8f06f3b6c2c695f2dfc3c26f31f5fef8661f8c5fe7c95aeb5c5b0435b045</rs1><aux>f8324dd18ea905171ec2be89f879d01d5994132048d92ea020778cbdf31c605e</aux><rs2>2fdcef69380937c2cf221f7d11526f286c39f49641452ba9012521c705094899</rs2><uri>%s</uri><rcvKey>08df5907d30959b8cb70f6fff2d8febd88fb41b0c8afc39e4b972f86dd5cfe2d</rcvKey><sndKey>60f020a3fe11dc2cc0e1e8ed9341b4cd14944db806ca4fc95456bbe45d95c43a</sndKey><rcvSId>5f9aa1e5e4c7ec88fa389a9f6b8879b42d3c57bb28e62068d2df23e8f9b77193</rcvSId><sndSId>bcffd51e7316a6c6f53a50fcf01b01bf2d3c57bb28e62068d2df23e8f9b77193</sndSId><rcvIndex>00000078</rcvIndex><sndIndex>000001cf</sndIndex><pvs>01</pvs></peer><peer><ZID>1234567889643d953a2202ee</ZID><rs1>9b5c8f06f3b6c2c695f2dfc3c26f31f5fef8661f8c5fe7c95aeb5c5b0435b045</rs1><aux>f8324dd18ea905171ec2be89f879d01d5994132048d92ea020778cbdf31c605e</aux><rs2>2fdcef69380937c2cf221f7d11526f286c39f49641452ba9012521c705094899</rs2><uri>%s</uri><sndKey>81e6e6362c34dc974263d1f77cbb9a8d6d6a718330994379099a8fa19fb12faa</sndKey><rcvKey>25d9ac653a83c4559cb0ae7394e7cd3b2d3c57bb28e62068d2df23e8f9b77193</rcvKey><sndSId>f69aa1e5e4c7ec88fa389a9f6b8879b42d3c57bb28e62068d2df23e8f9b77193</sndSId><rcvSId>22ffd51e7316a6c6f53a50fcf01b01bf2d3c57bb28e62068d2df23e8f9b77193</rcvSId><sndIndex>0000002e</sndIndex><rcvIndex>00000000</rcvIndex><pvs>01</pvs></peer></cache>", marie_id, marie_id);
fclose(ZIDCacheMarieFD);
fclose(ZIDCachePaulineFD);
......
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