vty: fix unreachable code (error msg on trunk alloc fail)
When a trunk is selected that does not exist, a new one is created. In
this case the VTY would print an error message but the function exits
early. The code that would print the error is unreachable.
Change-Id: Ie8c3b083174eb8209df2c06f65db6d7bbfaa87f7
fixes: CID#210637
diff --git a/src/libosmo-mgcp/mgcp_vty.c b/src/libosmo-mgcp/mgcp_vty.c
index 6a431e5..bdcb55c 100644
--- a/src/libosmo-mgcp/mgcp_vty.c
+++ b/src/libosmo-mgcp/mgcp_vty.c
@@ -813,14 +813,11 @@
trunk = mgcp_trunk_num(g_cfg, index);
if (!trunk) {
trunk = mgcp_trunk_alloc(g_cfg, MGCP_TRUNK_E1, index);
- if (!trunk)
+ if (!trunk) {
+ vty_out(vty, "%%Unable to allocate trunk %u.%s",
+ index, VTY_NEWLINE);
return CMD_WARNING;
- }
-
- if (!trunk) {
- vty_out(vty, "%%Unable to allocate trunk %u.%s",
- index, VTY_NEWLINE);
- return CMD_WARNING;
+ }
}
vty->node = TRUNK_NODE;