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
This commit is contained in:
Philipp Maier
2020-05-29 16:20:25 +02:00
parent c39b1bffec
commit 2d681fd84c

View File

@@ -813,14 +813,11 @@ ALIAS_DEPRECATED(cfg_mgcp_agent_addr, cfg_mgcp_agent_addr_cmd_old,
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;