Fixed a crash in source address lookup

This commit is contained in:
Martin Willi
2009-09-23 11:18:30 +02:00
parent a7f79ee9c1
commit 0406ed7a16
@@ -861,7 +861,9 @@ static host_t *get_route(private_kernel_netlink_net_t *this, host_t *dest,
{ {
/* got a source address */ /* got a source address */
new_src = host_create_from_chunk(msg->rtm_family, rta_src, 0); new_src = host_create_from_chunk(msg->rtm_family, rta_src, 0);
if (get_vip_refcount(this, src)) if (new_src)
{
if (get_vip_refcount(this, new_src))
{ /* skip source address if it is installed by us */ { /* skip source address if it is installed by us */
new_src->destroy(new_src); new_src->destroy(new_src);
} }
@@ -871,6 +873,7 @@ static host_t *get_route(private_kernel_netlink_net_t *this, host_t *dest,
src = new_src; src = new_src;
best = msg->rtm_dst_len; best = msg->rtm_dst_len;
} }
}
continue; continue;
} }
if (rta_gtw.ptr) if (rta_gtw.ptr)