From: Michael Tremer Date: Thu, 6 Mar 2025 16:24:46 +0000 (+0000) Subject: tree: Add network to the stack after we have tried again X-Git-Tag: 0.9.18~23 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3836b1a0fbe65fbb3f6b8021e38c28b950ba9a11;p=location%2Flibloc.git tree: Add network to the stack after we have tried again If we add it before, we will try to merge the network with itself which is not necessary as it will never result in anything good. Signed-off-by: Michael Tremer --- diff --git a/src/network-tree.c b/src/network-tree.c index 7096625..c2627e3 100644 --- a/src/network-tree.c +++ b/src/network-tree.c @@ -396,11 +396,6 @@ static int loc_network_tree_merge_step(struct loc_network* network, void* data) if (r) goto ERROR; - // Add the new network to the stack - r = loc_network_list_push(ctx->networks, m); - if (r) - goto ERROR; - // Remove the previous network from the stack r = loc_network_list_remove(ctx->networks, n); if (r) @@ -414,6 +409,11 @@ static int loc_network_tree_merge_step(struct loc_network* network, void* data) if (r) goto ERROR; + // Add the new network to the stack + r = loc_network_list_push(ctx->networks, m); + if (r) + goto ERROR; + loc_network_unref(m); m = NULL;