Do not attempt to free static memory.
Reference ISC BIND issue: ``1278. [bug] free() of non-malloced memory in nslookup.'' Reported by: phkmalloc, Mike Tancsa <mike@sentex.net>
This commit is contained in:
parent
e0f783d4f8
commit
9aee5e4673
@ -387,10 +387,8 @@ GetAnswer(nsAddrPtr, queryType, msg, msglen, iquery, hostPtr, isServer,
|
||||
for (l = 0; l < k; l++)
|
||||
if (!strcasecmp(hostPtr->aliases[l], host_aliases[i]))
|
||||
break;
|
||||
if (l < k) {
|
||||
free(host_aliases[i]);
|
||||
if (l < k)
|
||||
continue;
|
||||
}
|
||||
hostPtr->aliases[k] = Calloc(1, host_aliases_len[i]);
|
||||
memcpy(hostPtr->aliases[k], host_aliases[i],
|
||||
host_aliases_len[i]);
|
||||
@ -420,10 +418,8 @@ GetAnswer(nsAddrPtr, queryType, msg, msglen, iquery, hostPtr, isServer,
|
||||
!memcmp(hostPtr->addrList[l]->addr, addr_list[i],
|
||||
addr_len[i]))
|
||||
break;
|
||||
if (l < k) {
|
||||
free(addr_list[i]);
|
||||
if (l < k)
|
||||
continue;
|
||||
}
|
||||
hostPtr->addrList[k] = (AddrInfo*)Calloc(1, sizeof(AddrInfo));
|
||||
hostPtr->addrList[k]->addr = Calloc(1, addr_len[i]);
|
||||
hostPtr->addrList[k]->addrType = addr_type[i];
|
||||
|
Loading…
Reference in New Issue
Block a user