From b7020d452e0cd0a4eb99f6371ccdf7201f3c98e1 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Fri, 11 Mar 2016 17:46:18 +0100 Subject: [PATCH] fix memory leak in event test suite --- coreapi/event.c | 4 +++- tester/eventapi_tester.c | 10 +++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/coreapi/event.c b/coreapi/event.c index 36579d0d2..e8d2ac49a 100644 --- a/coreapi/event.c +++ b/coreapi/event.c @@ -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); diff --git a/tester/eventapi_tester.c b/tester/eventapi_tester.c index 7828aacdf..e3b6344ee 100644 --- a/tester/eventapi_tester.c +++ b/tester/eventapi_tester.c @@ -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,