1yfgT53 / libjingle

Automatically exported from code.google.com/p/libjingle
0 stars 0 forks source link

Many Memory Leaks in Libjingle... #284

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
in callclient.cc
void CallClient::InitPresence() {
  presence_push_ = new buzz::PresencePushTask(xmpp_client_, this);
  presence_push_->SignalStatusUpdate.connect(
    this, &CallClient::OnStatusUpdate);
  presence_push_->SignalMucJoined.connect(this, &CallClient::OnMucJoined);
  presence_push_->SignalMucLeft.connect(this, &CallClient::OnMucLeft);
  presence_push_->SignalMucStatusUpdate.connect(
    this, &CallClient::OnMucStatusUpdate);
  presence_push_->SignalFriendAuthorizeReceived.connect(this, &CallClient::OnFriendAuthorizeReceived);
  presence_push_->Start();

  presence_out_ = new buzz::PresenceOutTask(xmpp_client_);
  RefreshStatus();
  presence_out_->Start();
...
}

presence_push_ and presence_out_ are created dynamically by 'new'
But no 'delete' operation...

And talk/xmpp/***task.cc there is also no delete opereation like following.

in talk/xmpp/mucroomlookuptalk.cc
XmlElement* MucRoomLookupTask::MakeJidQuery(const Jid& room_jid) {
  XmlElement* jid_elem = new XmlElement(QN_SEARCH_ROOM_JID);
  jid_elem->SetBodyText(room_jid.Str());

  XmlElement* query = new XmlElement(QN_SEARCH_QUERY);
  query->AddElement(jid_elem);
  return query;
}

Could you resolve this problem(MEMORY LEAK) in next versoin of library?
Thank you.

Original issue reported on code.google.com by adam1988...@gmail.com on 20 Jan 2012 at 9:03

GoogleCodeExporter commented 9 years ago
in presenceouttask.cc
XmppReturnStatus PresenceOutTask::SendProbe(const Jid & jid) {
  if (GetState() != STATE_INIT && GetState() != STATE_START)
    return XMPP_RETURN_BADSTATE;

  XmlElement * presence = new XmlElement(QN_PRESENCE);
  presence->AddAttr(QN_TO, jid.Str());
  presence->AddAttr(QN_TYPE, "probe");

  QueueStanza(presence);
  delete presence;
  return XMPP_RETURN_OK;
}
As you can see after queueing stanze it(presence) is deleted.
but in other task, after queueing stanze, it is never deleted.
in mucinvitesendtask.cc --no delete operation
XmppReturnStatus
MucInviteSendTask::Send(const Jid& to, const Jid& invitee) {
  if (GetState() != STATE_INIT && GetState() != STATE_START)
    return XMPP_RETURN_BADSTATE;

  XmlElement* message = new XmlElement(QN_MESSAGE);
  message->AddAttr(QN_TO, to.Str());
  XmlElement* xstanza = new XmlElement(QN_MUC_USER_X);
  XmlElement* invite = new XmlElement(QN_MUC_USER_INVITE);
  invite->AddAttr(QN_TO, invitee.Str());
  xstanza->AddElement(invite);
  message->AddElement(xstanza);

  QueueStanza(message);
  return XMPP_RETURN_OK;
}

Original comment by adam1988...@gmail.com on 20 Jan 2012 at 9:23

GoogleCodeExporter commented 9 years ago
These problems were already commented on issue 246. The comment #2 points the 
same problem in another class (As I commented on issue 246, 
MucInviteSendTask::Send and FriendInviteSendTask::Send also have this problem). 
Adam, the example you gave (PresenceOutTask::SendProbe) was actually fixed 
after my comment on issue 246, but many other were left behind, so I think 
every stanza sender class should be checked.

Original comment by diego.cd...@gmail.com on 20 Jan 2012 at 10:46

GoogleCodeExporter commented 9 years ago

Original comment by jun...@google.com on 10 Feb 2012 at 12:54