text2pcap: fix crash when there is no argument

Bug: 14082
Change-Id: Ifd8b2bf9bee817967e3b00e01b8b4ae90970e984
Reviewed-on: https://code.wireshark.org/review/23727
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Pascal Quantin 2017-09-25 17:51:05 +02:00 committed by Michael Mann
parent f649064130
commit 33c00a6741
1 changed files with 10 additions and 3 deletions

View File

@ -1881,7 +1881,10 @@ main(int argc, char *argv[])
{
int ret = EXIT_SUCCESS;
parse_options(argc, argv);
if (parse_options(argc, argv) != EXIT_SUCCESS) {
ret = EXIT_FAILURE;
goto clean_exit;
}
assert(input_file != NULL);
assert(output_file != NULL);
@ -1933,8 +1936,12 @@ main(int argc, char *argv[])
}
clean_exit:
text2pcap_lex_destroy();
fclose(input_file);
fclose(output_file);
if (input_file) {
fclose(input_file);
}
if (output_file) {
fclose(output_file);
}
return ret;
}