Fix crash in rk_freeifaddrs due to freeing an invalid pointer

Crash occurs on Linux systems that support AF_NETLINK but do not have
getifaddrs() in libc (eg. SuSE 8.1).

Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
This commit is contained in:
Ted Percival
2009-08-04 15:33:56 -06:00
committed by Love Hornquist Astrand
parent 0ede7ac561
commit 1cbb0e766d

View File

@@ -853,6 +853,13 @@ rk_getifaddrs(struct ifaddrs **ifap)
return 0;
}
void ROKEN_LIB_FUNCTION
rk_freeifaddrs(struct ifaddrs *ifp)
{
/* AF_NETLINK method uses a single allocation for all interfaces */
free(ifp);
}
#else /* !AF_NETLINK */
/*
@@ -1175,8 +1182,6 @@ rk_getifaddrs(struct ifaddrs **ifap)
return ret;
}
#endif /* !AF_NETLINK */
void ROKEN_LIB_FUNCTION
rk_freeifaddrs(struct ifaddrs *ifp)
{
@@ -1198,6 +1203,8 @@ rk_freeifaddrs(struct ifaddrs *ifp)
}
}
#endif /* !AF_NETLINK */
#ifdef TEST
void