Bug 1240515 - change allocator for addr and localaddr from malloc to new, since the smart pointer that is used uses delete operator. r=dragana

--HG--
extra : transplant_source : N%80%F2%14%3C%84%90%C7%9A%866g%C2R%27%A0%2C%7E%ADc
This commit is contained in:
Bogdan Postelnicu 2016-01-20 12:31:01 +02:00
parent 2e4a107162
commit 0190fc58af

View File

@ -194,21 +194,21 @@ void nsNotifyAddrListener::OnNetlinkMessage(int aNetlinkSocket)
if (attr->rta_type == IFA_ADDRESS) {
if (newifam->ifa_family == AF_INET) {
struct in_addr* in = (struct in_addr*)RTA_DATA(attr);
addr = (char*)malloc(INET_ADDRSTRLEN);
addr = new char[INET_ADDRSTRLEN];
inet_ntop(AF_INET, in, addr.get(), INET_ADDRSTRLEN);
} else {
struct in6_addr* in = (struct in6_addr*)RTA_DATA(attr);
addr = (char*)malloc(INET6_ADDRSTRLEN);
addr = new char[INET6_ADDRSTRLEN];
inet_ntop(AF_INET6, in, addr.get(), INET6_ADDRSTRLEN);
}
} else if (attr->rta_type == IFA_LOCAL) {
if (newifam->ifa_family == AF_INET) {
struct in_addr* in = (struct in_addr*)RTA_DATA(attr);
localaddr = (char*)malloc(INET_ADDRSTRLEN);
localaddr = new char[INET_ADDRSTRLEN];
inet_ntop(AF_INET, in, localaddr.get(), INET_ADDRSTRLEN);
} else {
struct in6_addr* in = (struct in6_addr*)RTA_DATA(attr);
localaddr = (char*)malloc(INET6_ADDRSTRLEN);
localaddr = new char[INET6_ADDRSTRLEN];
inet_ntop(AF_INET6, in, localaddr.get(), INET6_ADDRSTRLEN);
}
}