commands: devlookup: fix memory leak in error case There's a string_list_free after out:, which we are skipping when we directly return.
Signed-off-by: Ahmad Fatoum <a.fat...@pengutronix.de> --- commands/devlookup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/commands/devlookup.c b/commands/devlookup.c index 5877d5f1b82c..b7fd7be3b624 100644 --- a/commands/devlookup.c +++ b/commands/devlookup.c @@ -59,7 +59,8 @@ static int do_devlookup(int argc, char *argv[]) aliasbuf = string_list_join(&sl, " "); if (string_list_count(&sl) > 1 && (kernelopt || paramname)) { printf("Option not supported for multi cdev alias\n"); - return COMMAND_ERROR; + ret = COMMAND_ERROR; + goto out; } if (alias) { -- 2.39.5