* net.cc (if_nametoindex): This time, really free IP_ADAPTER_ADDRESSES
memory. (if_indextoname): Ditto.
This commit is contained in:
parent
fd1bf882f5
commit
e7fc99384e
|
@ -1,3 +1,9 @@
|
||||||
|
2007-01-24 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* net.cc (if_nametoindex): This time, really free IP_ADAPTER_ADDRESSES
|
||||||
|
memory.
|
||||||
|
(if_indextoname): Ditto.
|
||||||
|
|
||||||
2007-01-24 Corinna Vinschen <corinna@vinschen.de>
|
2007-01-24 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* security.h (pop_thread_privilege): Revert to previous state, not
|
* security.h (pop_thread_privilege): Revert to previous state, not
|
||||||
|
|
|
@ -2091,7 +2091,7 @@ get_ifconf (SOCKET s, struct ifconf *ifc, int what)
|
||||||
extern "C" unsigned
|
extern "C" unsigned
|
||||||
if_nametoindex (const char *name)
|
if_nametoindex (const char *name)
|
||||||
{
|
{
|
||||||
PIP_ADAPTER_ADDRESSES pap = NULL;
|
PIP_ADAPTER_ADDRESSES pa0 = NULL, pap;
|
||||||
unsigned index = 0;
|
unsigned index = 0;
|
||||||
|
|
||||||
myfault efault;
|
myfault efault;
|
||||||
|
@ -2107,13 +2107,13 @@ if_nametoindex (const char *name)
|
||||||
strncat (lname, name, IF_NAMESIZE - 1);
|
strncat (lname, name, IF_NAMESIZE - 1);
|
||||||
if (lname[0] == '{' && (c = strchr (lname, ':')))
|
if (lname[0] == '{' && (c = strchr (lname, ':')))
|
||||||
*c = '\0';
|
*c = '\0';
|
||||||
for (; pap; pap = pap->Next)
|
for (pap = pa0; pap; pap = pap->Next)
|
||||||
if (strcasematch (lname, pap->AdapterName))
|
if (strcasematch (lname, pap->AdapterName))
|
||||||
{
|
{
|
||||||
index = pap->IfIndex;
|
index = pap->IfIndex;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
free (pap);
|
free (pa0);
|
||||||
}
|
}
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
@ -2121,7 +2121,7 @@ if_nametoindex (const char *name)
|
||||||
extern "C" char *
|
extern "C" char *
|
||||||
if_indextoname (unsigned ifindex, char *ifname)
|
if_indextoname (unsigned ifindex, char *ifname)
|
||||||
{
|
{
|
||||||
PIP_ADAPTER_ADDRESSES pap = NULL;
|
PIP_ADAPTER_ADDRESSES pa0 = NULL, pap;
|
||||||
char *name = NULL;
|
char *name = NULL;
|
||||||
|
|
||||||
myfault efault;
|
myfault efault;
|
||||||
|
@ -2129,15 +2129,15 @@ if_indextoname (unsigned ifindex, char *ifname)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (wincap.has_gaa_prefixes ()
|
if (wincap.has_gaa_prefixes ()
|
||||||
&& get_adapters_addresses (&pap, AF_UNSPEC))
|
&& get_adapters_addresses (&pa0, AF_UNSPEC))
|
||||||
{
|
{
|
||||||
for (; pap; pap = pap->Next)
|
for (pap = pa0; pap; pap = pap->Next)
|
||||||
if (ifindex == pap->IfIndex)
|
if (ifindex == pap->IfIndex)
|
||||||
{
|
{
|
||||||
name = strcpy (ifname, pap->AdapterName);
|
name = strcpy (ifname, pap->AdapterName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
free (pap);
|
free (pa0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
set_errno (ENXIO);
|
set_errno (ENXIO);
|
||||||
|
|
Loading…
Reference in New Issue