Fix some failed asserts due to add_tail()
When config structures are copied due to template application, we need to reset list node structure before calling add_tail(). Thanks to Mikael Magnusson for patches.
This commit is contained in:
parent
c9ae81656f
commit
1678bc0746
3 changed files with 3 additions and 0 deletions
|
@ -573,6 +573,7 @@ cfg_copy_list(list *dest, list *src, unsigned node_size)
|
||||||
{
|
{
|
||||||
dn = cfg_alloc(node_size);
|
dn = cfg_alloc(node_size);
|
||||||
memcpy(dn, sn, node_size);
|
memcpy(dn, sn, node_size);
|
||||||
|
memset(dn, 0, sizeof(node));
|
||||||
add_tail(dest, dn);
|
add_tail(dest, dn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -626,6 +626,7 @@ channel_copy_config(struct channel_config *src, struct proto_config *proto)
|
||||||
struct channel_config *dst = cfg_alloc(src->channel->config_size);
|
struct channel_config *dst = cfg_alloc(src->channel->config_size);
|
||||||
|
|
||||||
memcpy(dst, src, src->channel->config_size);
|
memcpy(dst, src, src->channel->config_size);
|
||||||
|
memset(&dst->n, 0, sizeof(node));
|
||||||
add_tail(&proto->channels, &dst->n);
|
add_tail(&proto->channels, &dst->n);
|
||||||
CALL(src->channel->copy_config, dst, src);
|
CALL(src->channel->copy_config, dst, src);
|
||||||
|
|
||||||
|
|
|
@ -643,6 +643,7 @@ static_copy_config(struct proto_config *dest, struct proto_config *src)
|
||||||
{
|
{
|
||||||
dnh = cfg_alloc(sizeof(struct static_route));
|
dnh = cfg_alloc(sizeof(struct static_route));
|
||||||
memcpy(dnh, snh, sizeof(struct static_route));
|
memcpy(dnh, snh, sizeof(struct static_route));
|
||||||
|
memset(&dnh->n, 0, sizeof(node));
|
||||||
|
|
||||||
if (!drt)
|
if (!drt)
|
||||||
add_tail(&d->routes, &(dnh->n));
|
add_tail(&d->routes, &(dnh->n));
|
||||||
|
|
Loading…
Reference in a new issue