Fix some memory leaks.

This commit is contained in:
Ghislain MARY 2017-10-16 17:04:20 +02:00
parent 894391c13b
commit 15fcc6950d
4 changed files with 16 additions and 11 deletions

View file

@ -136,11 +136,11 @@ private:
std::list<Content > contents;
Content internalContent;
std::unordered_map<std::string, std::string> customHeaders;
mutable LinphoneErrorInfo * errorInfo = NULL;
belle_http_request_t *httpRequest = NULL;
belle_http_request_listener_t *httpListener = NULL;
SalOp *salOp = NULL;
SalCustomHeader *salCustomHeaders = NULL;
mutable LinphoneErrorInfo * errorInfo = nullptr;
belle_http_request_t *httpRequest = nullptr;
belle_http_request_listener_t *httpListener = nullptr;
SalOp *salOp = nullptr;
SalCustomHeader *salCustomHeaders = nullptr;
unsigned long backgroundTaskId;
unsigned char currentSendStep = Step::None;
bool applyModifiers = true;
@ -148,7 +148,7 @@ private:
ContentType cContentType;
std::string cText;
// Used for compatibility with previous C API
LinphoneContent *cFileTransferInformation = NULL;
LinphoneContent *cFileTransferInformation = nullptr;
// -----------------------------------------------------------------------------

View file

@ -51,7 +51,10 @@ ChatMessagePrivate::ChatMessagePrivate (const shared_ptr<ChatRoom> &room)
: chatRoom(room) {
}
ChatMessagePrivate::~ChatMessagePrivate () {}
ChatMessagePrivate::~ChatMessagePrivate () {
if (salOp)
salOp->release();
}
// -----------------------------------------------------------------------------

View file

@ -266,9 +266,12 @@ void IsComposing::stopAllRemoteRefreshTimers () {
}
unordered_map<string, belle_sip_source_t *>::iterator IsComposing::stopRemoteRefreshTimer (const unordered_map<string, belle_sip_source_t *>::const_iterator it) {
if (core && core->sal)
core->sal->cancel_timer(it->second);
belle_sip_object_unref(it->second);
belle_sip_source_t *timer = it->second;
if (core && core->sal) {
core->sal->cancel_timer(timer);
delete reinterpret_cast<IsRemoteComposingData *>(belle_sip_source_get_user_data(timer));
}
belle_sip_object_unref(timer);
return remoteRefreshTimers.erase(it);
}

View file

@ -39,7 +39,6 @@ static void doNotify (const string &notify, LinphoneEvent *lev) {
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);
}
// -----------------------------------------------------------------------------