Commit b7020d45 authored by jehan's avatar jehan
Browse files

fix memory leak in event test suite

parent 9b28a0d1
......@@ -111,7 +111,7 @@ void linphone_event_set_state(LinphoneEvent *lev, LinphoneSubscriptionState stat
ms_message("LinphoneEvent [%p] moving to subscription state %s",lev,linphone_subscription_state_to_string(state));
lev->subscription_state=state;
linphone_core_notify_subscription_state_changed(lev->lc,lev,state);
if (state==LinphoneSubscriptionTerminated){
if (state==LinphoneSubscriptionTerminated || state == LinphoneSubscriptionError){
linphone_event_unref(lev);
}
}
......@@ -194,6 +194,7 @@ int linphone_event_send_subscribe(LinphoneEvent *lev, const LinphoneContent *bod
if (lev->send_custom_headers){
sal_op_set_sent_custom_header(lev->op,lev->send_custom_headers);
sal_custom_header_free(lev->send_custom_headers);
lev->send_custom_headers=NULL;
}else sal_op_set_sent_custom_header(lev->op,NULL);
......@@ -269,6 +270,7 @@ static int _linphone_event_send_publish(LinphoneEvent *lev, const LinphoneConten
}
if (lev->send_custom_headers){
sal_op_set_sent_custom_header(lev->op,lev->send_custom_headers);
sal_custom_header_free(lev->send_custom_headers);
lev->send_custom_headers=NULL;
}else sal_op_set_sent_custom_header(lev->op,NULL);
body_handler = sal_body_handler_from_content(body);
......
......@@ -359,15 +359,15 @@ static void publish_without_expires(void){
}
test_t event_tests[] = {
TEST_ONE_TAG("Subscribe declined", subscribe_test_declined, "LeaksMemory"),
TEST_ONE_TAG("Subscribe declined", subscribe_test_declined, "presence"),
TEST_ONE_TAG("Subscribe terminated by subscriber", subscribe_test_terminated_by_subscriber, "presence"),
TEST_ONE_TAG("Subscribe with custom headers", subscribe_test_with_custom_header, "LeaksMemory"),
TEST_ONE_TAG("Subscribe with custom headers", subscribe_test_with_custom_header, "presence"),
TEST_ONE_TAG("Subscribe refreshed", subscribe_test_refreshed, "presence"),
TEST_ONE_TAG("Subscribe manually refreshed", subscribe_test_manually_refreshed, "presence"),
TEST_ONE_TAG("Subscribe terminated by notifier", subscribe_test_terminated_by_notifier, "LeaksMemory"),
TEST_ONE_TAG("Publish", publish_test, "LeaksMemory"),
TEST_ONE_TAG("Publish without expires", publish_without_expires, "LeaksMemory"),
TEST_ONE_TAG("Publish without automatic refresh",publish_no_auto_test, "LeaksMemory")
TEST_ONE_TAG("Publish", publish_test, "presence"),
TEST_ONE_TAG("Publish without expires", publish_without_expires, "presence"),
TEST_ONE_TAG("Publish without automatic refresh",publish_no_auto_test, "presence")
};
test_suite_t event_test_suite = {"Event", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each,
......
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