Skip to content

Commit

Permalink
Fix memory leak in Agent DNS handler.
Browse files Browse the repository at this point in the history
The buffer allocated to send XMPP message is not freed.

Change-Id: I66f67eeedcfe3798d2fab1916293d972e3432007
closes-bug: 1493293
(cherry picked from commit 65b4158)
  • Loading branch information
haripk committed Sep 9, 2015
1 parent 218f909 commit 42e0ecd
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/vnsw/agent/services/dns_handler.cc
Expand Up @@ -730,7 +730,7 @@ void DnsHandler::SendXmppUpdate(AgentDnsXmppChannel *channel,
last = store.end();
xmpp_data->items.splice(xmpp_data->items.begin(), store, first, last);

uint8_t *data = new uint8_t[DnsAgentXmpp::max_dns_xmpp_msg_len];
uint8_t data[DnsAgentXmpp::max_dns_xmpp_msg_len];
xid_ = agent()->GetDnsProto()->GetTransId();
std::size_t len = 0;
if ((len = DnsAgentXmpp::DnsAgentXmppEncode(channel->GetXmppChannel(),
Expand All @@ -739,8 +739,6 @@ void DnsHandler::SendXmppUpdate(AgentDnsXmppChannel *channel,
data)) > 0) {
channel->SendMsg(data, len);
}
else
delete [] data;

done.splice(done.end(), xmpp_data->items, xmpp_data->items.begin(),
xmpp_data->items.end());
Expand Down

0 comments on commit 42e0ecd

Please sign in to comment.