Commit 384f99be authored by Ghislain MARY's avatar Ghislain MARY

Fix some memory leaks.

parent 4e798d8b
......@@ -49,7 +49,7 @@ void LocalConferenceEventHandlerPrivate::notifyFullState(string notify, Linphone
linphone_content_set_buffer(content, notify.c_str(), strlen(notify.c_str()));
linphone_event_notify(lev, content);
linphone_content_unref(content);
// linphone_event_unref(lev); ??
linphone_event_unref(lev);
}
void LocalConferenceEventHandlerPrivate::notifyAllExcept(string notify, const Address &addr) {
......
......@@ -51,10 +51,7 @@ RemoteConferenceEventHandler::RemoteConferenceEventHandler(LinphoneCore *core, C
}
RemoteConferenceEventHandler::~RemoteConferenceEventHandler() {
L_D();
xercesc::XMLPlatformUtils::Terminate();
if (d->lev)
linphone_event_unref(d->lev);
}
// -----------------------------------------------------------------------------
......@@ -65,16 +62,17 @@ void RemoteConferenceEventHandler::subscribe(const Address &addr) {
LinphoneAddress *lAddr = linphone_address_new(d->confAddress.asString().c_str());
d->lev = linphone_core_create_subscribe(d->core, lAddr, "Conference", 600);
linphone_address_unref(lAddr);
linphone_event_ref(d->lev);
linphone_event_set_internal(d->lev, TRUE);
linphone_event_set_user_data(d->lev, this);
linphone_event_add_custom_header(d->lev, "Conf-id", d->confAddress.getUsername().c_str()); // TODO : ???
linphone_event_send_subscribe(d->lev, nullptr);
}
void RemoteConferenceEventHandler::unsubscribe() {
L_D();
linphone_event_terminate(d->lev);
if (d->lev) {
linphone_event_terminate(d->lev);
d->lev = nullptr;
}
}
void RemoteConferenceEventHandler::notifyReceived(string xmlBody) {
......@@ -87,7 +85,9 @@ void RemoteConferenceEventHandler::notifyReceived(string xmlBody) {
if (confInfo->getEntity() == cleanedConfAddress.asString()) {
for (const auto &user : confInfo->getUsers()->getUser()) {
LinphoneAddress *cAddr = linphone_core_interpret_url(d->core, user.getEntity()->c_str());
Address addr(linphone_address_as_string(cAddr));
char *cAddrStr = linphone_address_as_string(cAddr);
Address addr(cAddrStr);
bctbx_free(cAddrStr);
if (user.getState() == "deleted")
d->listener->onParticipantRemoved(addr);
else {
......
......@@ -33,6 +33,7 @@ RemoteConference::RemoteConference (LinphoneCore *core, const Address &myAddress
}
RemoteConference::~RemoteConference () {
eventHandler->unsubscribe();
delete eventHandler;
}
......@@ -81,7 +82,9 @@ string RemoteConference::getResourceLists (const list<Address> &addresses) {
void RemoteConference::onConferenceCreated (const Address &addr) {}
void RemoteConference::onConferenceTerminated (const Address &addr) {}
void RemoteConference::onConferenceTerminated (const Address &addr) {
eventHandler->unsubscribe();
}
void RemoteConference::onParticipantAdded (const Address &addr) {}
......
......@@ -600,9 +600,8 @@ void CallSessionPrivate::setContactOp () {
LinphoneAddress *contact = getFixedContact();
if (contact) {
salAddress = const_cast<SalAddress *>(L_GET_PRIVATE_FROM_C_OBJECT(contact)->getInternalAddress());
sal_address_ref(salAddress);
linphone_address_unref(contact);
sal_op_set_contact_address(op, salAddress);
linphone_address_unref(contact);
}
}
......
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