Commit a6d022f0 authored by Benjamin REIS's avatar Benjamin REIS

avoid invalid read in event_tester callbacks

parent e289a58a
......@@ -43,10 +43,18 @@ void linphone_notify_received(LinphoneCore *lc, LinphoneEvent *lev, const char *
/*hack to disable content checking for list notify */
BC_ASSERT_STRING_EQUAL(linphone_content_get_string_buffer(content), notify_content);
}
mgr=get_manager(lc);
mgr = get_manager(lc);
mgr->stat.number_of_NotifyReceived++;
}
void linphone_subscribe_received(LinphoneCore *lc, LinphoneEvent *lev, const char *eventname, const LinphoneContent *content) {
LinphoneCoreManager *mgr = get_manager(lc);
if (!mgr->decline_subscribe)
linphone_event_accept_subscription(lev);
else
linphone_event_deny_subscription(lev, LinphoneReasonDeclined);
}
void linphone_subscription_state_change(LinphoneCore *lc, LinphoneEvent *lev, LinphoneSubscriptionState state) {
stats* counters = get_stats(lc);
LinphoneCoreManager *mgr=get_manager(lc);
......@@ -67,10 +75,6 @@ void linphone_subscription_state_change(LinphoneCore *lc, LinphoneEvent *lev, Li
case LinphoneSubscriptionIncomingReceived:
counters->number_of_LinphoneSubscriptionIncomingReceived++;
mgr->lev=lev;
if (!mgr->decline_subscribe)
linphone_event_accept_subscription(lev);
else
linphone_event_deny_subscription(lev, LinphoneReasonDeclined);
break;
case LinphoneSubscriptionOutgoingProgress:
counters->number_of_LinphoneSubscriptionOutgoingProgress++;
......
......@@ -371,6 +371,7 @@ void new_subscription_requested(LinphoneCore *lc, LinphoneFriend *lf, const char
void linphone_subscription_state_change(LinphoneCore *lc, LinphoneEvent *ev, LinphoneSubscriptionState state);
void linphone_publish_state_changed(LinphoneCore *lc, LinphoneEvent *ev, LinphonePublishState state);
void linphone_notify_received(LinphoneCore *lc, LinphoneEvent *lev, const char *eventname, const LinphoneContent *content);
void linphone_subscribe_received(LinphoneCore *lc, LinphoneEvent *lev, const char *eventname, const LinphoneContent *content);
void linphone_configuration_status(LinphoneCore *lc, LinphoneConfiguringState status, const char *message);
void linphone_call_encryption_changed(LinphoneCore *lc, LinphoneCall *call, bool_t on, const char *authentication_token);
void dtmf_received(LinphoneCore *lc, LinphoneCall *call, int dtmf);
......
......@@ -364,6 +364,7 @@ void linphone_core_manager_init(LinphoneCoreManager *mgr, const char* rc_file, c
linphone_core_cbs_set_info_received(mgr->cbs, info_message_received);
linphone_core_cbs_set_subscription_state_changed(mgr->cbs, linphone_subscription_state_change);
linphone_core_cbs_set_notify_received(mgr->cbs, linphone_notify_received);
linphone_core_cbs_set_subscribe_received(mgr->cbs, linphone_subscribe_received);
linphone_core_cbs_set_publish_state_changed(mgr->cbs, linphone_publish_state_changed);
linphone_core_cbs_set_configuring_status(mgr->cbs, linphone_configuration_status);
linphone_core_cbs_set_call_encryption_changed(mgr->cbs, linphone_call_encryption_changed);
......@@ -441,7 +442,7 @@ LinphoneCoreManager* linphone_core_manager_create(const char* rc_file) {
LinphoneCoreManager* linphone_core_manager_new4(const char* rc_file, int check_for_proxies, const char* phone_alias, const char* contact_params, int expires) {
/* This function is for testing purposes. */
LinphoneCoreManager *manager = ms_new0(LinphoneCoreManager, 1);
linphone_core_manager_init(manager, rc_file, phone_alias);
linphone_proxy_config_set_contact_parameters(linphone_core_get_default_proxy_config(manager->lc), contact_params);
linphone_proxy_config_set_expires(linphone_core_get_default_proxy_config(manager->lc), expires);
......
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