From 705437254d8947b4b33e768d449fc595a89334ed Mon Sep 17 00:00:00 2001 From: Falk Werner Date: Thu, 31 Jan 2019 21:43:49 +0100 Subject: [PATCH] fix: fixed memory leak --- src/app/main.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/app/main.c b/src/app/main.c index d9ab349..0df6f2a 100644 --- a/src/app/main.c +++ b/src/app/main.c @@ -15,7 +15,7 @@ struct args { struct wsfs_server_config config; char * mount_point; - int show_help; + bool show_help; }; static void show_help(void) @@ -97,16 +97,20 @@ static int parse_arguments(int argc, char * argv[], struct args * args) } } + if ((EXIT_SUCCESS == result) && (!args->show_help)) + { + if (NULL == args->mount_point) + { + fprintf(stderr, "error: missing mount point\n"); + result = EXIT_FAILURE; + } + } + if (EXIT_SUCCESS != result) { args->show_help = true; } - if ((!args->show_help) && (NULL == args->mount_point)) - { - fprintf(stderr, "error: missing mount point\n"); - } - return result; }