From 20a7e7fe42dfa9e5de91ebfffc2cfd128099fa6a Mon Sep 17 00:00:00 2001 From: Pascal Quantin Date: Mon, 9 Nov 2015 15:25:40 +0100 Subject: file.c: do not try to close a file descriptor that was previously already closed Bug: 11684 Change-Id: Iaaa5958ea6192ef52b669c687082469b8c7c0219 Reviewed-on: https://code.wireshark.org/review/11656 Reviewed-by: Pascal Quantin Petri-Dish: Pascal Quantin Tested-by: Petri Dish Buildbot Reviewed-by: Jim Young Reviewed-by: Anders Broman --- file.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'file.c') diff --git a/file.c b/file.c index 16972ffdf7..b83bd27138 100644 --- a/file.c +++ b/file.c @@ -1382,11 +1382,13 @@ cf_merge_files(char **out_filenamep, int in_file_count, case MERGE_ERR_CANT_OPEN_INFILE: cf_open_failure_alert_box(in_filenames[err_fileno], err, err_info, FALSE, 0); + ws_close(out_fd); break; case MERGE_ERR_CANT_OPEN_OUTFILE: cf_open_failure_alert_box(out_filename, err, err_info, TRUE, file_type); + ws_close(out_fd); break; case MERGE_ERR_CANT_READ_INFILE: /* fall through */ @@ -1399,7 +1401,8 @@ cf_merge_files(char **out_filenamep, int in_file_count, } g_free(err_info); - ws_close(out_fd); + /* for general case, no need to close out_fd: file handle associated to this file + descriptor was already closed by the call to wtap_dump_close() in merge_files() */ if (status != MERGE_OK) { /* Callers aren't expected to treat an error or an explicit abort -- cgit v1.2.1