tun: Fix potential unpaired call to osmo_netns_switch_exit()

Fixes: Coverity CID#307429
Change-Id: Iadfc9eb48c6342433eee8da3e4d00ee496df3c75
This commit is contained in:
Pau Espin 2023-01-26 13:20:19 +01:00 committed by pespin
parent 1466daf75d
commit d3455fa620
1 changed files with 2 additions and 1 deletions

View File

@ -407,7 +407,8 @@ err_close_tun:
close(tundev->wqueue.bfd.fd);
tundev->wqueue.bfd.fd = -1;
err_restore_ns:
osmo_netns_switch_exit(&switch_state);
if (tundev->netns_name)
osmo_netns_switch_exit(&switch_state);
err_close_netns_fd:
if (netns_fd >= 0)
close(netns_fd);