dcb: fix memory leak

main() dinamically allocates dcb, but when dcb_help() is called it
returns without freeing it.

Fix this using a goto, as it is already done in the same function.

Fixes: 67033d1c1c ("Add skeleton of a new tool, dcb")
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Reviewed-by: Petr Machata <me@pmachata.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
This commit is contained in:
Andrea Claudi 2021-05-01 18:39:23 +02:00 committed by David Ahern
parent cfd89a6f8b
commit 2d212aae55
1 changed files with 2 additions and 1 deletions

View File

@ -571,7 +571,8 @@ int main(int argc, char **argv)
break;
case 'h':
dcb_help();
return 0;
ret = EXIT_SUCCESS;
goto dcb_free;
default:
fprintf(stderr, "Unknown option.\n");
dcb_help();