bonding: memory leak on parsing bad CLI command

When parsing bad "create bond" command, we should call unformat_free
prior to return

Type: fix
Fixes: 9cd2d7a5a4

Signed-off-by: Steven Luong <sluong@cisco.com>
Change-Id: I8f20a0e7f29de670e09633880d0aa50a51444e11
This commit is contained in:
Steven Luong
2022-01-06 13:02:00 -08:00
committed by Damjan Marion
parent e88c93324a
commit ed999e3b81

View File

@@ -510,12 +510,18 @@ bond_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
if (args.mode == BOND_MODE_LACP)
args.numa_only = 1;
else
return clib_error_return (0,
"Only lacp mode supports numa-only so far!");
{
unformat_free (line_input);
return clib_error_return (
0, "Only lacp mode supports numa-only so far!");
}
}
else
return clib_error_return (0, "unknown input `%U'",
format_unformat_error, input);
{
unformat_free (line_input);
return clib_error_return (0, "unknown input `%U'",
format_unformat_error, input);
}
}
unformat_free (line_input);