fix: don't attempt to cleanup uninitialized multiGwTunnels 26/head
authorNeels Hofmeyr <neels@hofmeyr.de>
Fri, 16 Jun 2017 01:37:25 +0000 (03:37 +0200)
committerNeels Hofmeyr <neels@hofmeyr.de>
Thu, 22 Jun 2017 19:34:13 +0000 (21:34 +0200)
commite6bdcbf30eca17de24721110b32ffa35d250545c
treeba2a4281eb0624147df618d9c8013ad4ebb6ee99
parentd932d401709ca8649d159aaf32b0d30790ed580d
fix: don't attempt to cleanup uninitialized multiGwTunnels

If olsr_cnf->smart_gw_use_count is 1, no multi-gw tunnels are initialized, and
the sgwTunnel4InterfaceNames and sgwTunnel6InterfaceNames are actually NULL. Do
not attempt to cleanup those if NULL.

Symptom: stopping olsrd e.g. via SIGINT leads to a segfault during cleanup.
The reason is that smart_gw_use_count is 1, which attempts to then dereference
one of sgwTunnel{4,6}InterfaceNames[0], amounting to <NULL>[0].

Signed-off-by: Neels Hofmeyr <neels@hofmeyr.de>
src/gateway.c