fix: fixed memory leak

pull/10/head
Falk Werner 6 years ago
parent 0c0c94242a
commit 705437254d

@ -15,7 +15,7 @@ struct args
{ {
struct wsfs_server_config config; struct wsfs_server_config config;
char * mount_point; char * mount_point;
int show_help; bool show_help;
}; };
static void show_help(void) 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; return result;

Loading…
Cancel
Save