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 | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 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,14 +97,18 @@ static int parse_arguments(int argc, char * argv[], struct args * args) } } - if (EXIT_SUCCESS != result) + if ((EXIT_SUCCESS == result) && (!args->show_help)) { - args->show_help = true; + if (NULL == args->mount_point) + { + fprintf(stderr, "error: missing mount point\n"); + result = EXIT_FAILURE; + } } - if ((!args->show_help) && (NULL == args->mount_point)) + if (EXIT_SUCCESS != result) { - fprintf(stderr, "error: missing mount point\n"); + args->show_help = true; } return result;