Hello Juliusz!
Axel and Simon are right, in the situation you have described the protocol wouldn't loop. It is a broken route.
S crashes, and A switches to B as its next hop for S. At this point, B is still using A as its next hop, so we have a temporary routing loop.
If S crashes A and B are not going to change their routing tables anymore - since S doesn't send any OGMs anymore which could trigger a change in the routing tables of A and B. So A and B stay put until the garbage collector purges the broken route. The assumption that A switches to B is false.
The reason why I believe that Batman is loop free is, that routes are updated upon receiving OGMs from the best ranking next hop. The best ranking next hop knows the best route better than me, because its likelihood of receiving OGMs is greater than the local likelihood. If a locally received OGM - received via the best ranking neighbor - triggers an update it is granted that the best ranking next hop is already informed - naturally,,, So the chain of potential forwarders is loop free until the destination.
This is particularly so because the current implementations are sequence number based, rather than using timers. This is granting that temporary loops can't occur - which could happen if timers could occasionally trigger purges that are not synced.
This is consistent with the test results of Batman-Experimental at Meraka in a physical 49-node grid. I did some inital tests there on the 4 longest possible routes in the grid (from each corner to each opposite corner, from each center of side to center of opposite side) at -30 dBm transmit power, -30dbm receive attenuation. 4 simultaneous traffic streams were saturating the capacity of these routes, all colliding in the center of the grid. Links were very weak, with high packet loss to single hop neighbors even when the whole network was idle. So a round trip from corner to corner often took 12 - 15 hops.
Under no circumstances did the protocol loop. Also we did run a long series of tests with Batman-EXP and OLSR with ETX and Fisheye enabled, that David Johnson had previously used to compare mesh routing protocols, like AODV, DART, OLSR-RFC, OLSR with ETX .
http://wirelessafrica.meraka.org.za/wiki/images/9/98/Batman_ifip.pdf
cu elektra