database: Fix backtracking after no match was found at the end of the tree
This is a rare bug which only appears if the tree has not been 100%
optimised which might happen because it would not be worth the effort to
remove all dead ends all of the time.
Therefore, we could be reaching a node which is not an actual leaf but
still not find our network. In that case, we will have to go backwards
slightly to check if there has been a less specific match (but a match
nonetheless).
This was broken in commit
9e72b8a0c56403ca7d23c6a767d66038e0d63c14 when
the return code for no match was changed to zero.
Fixes: #13861 - libloc-0.9.18 fails to find some ASN info
Reported-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>