aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/file_access.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2012-12-26 11:59:47 +0000
committerGuy Harris <guy@alum.mit.edu>2012-12-26 11:59:47 +0000
commit1825519526807c3eb851ee83ce8f5aed50f48d36 (patch)
treed495ab4a30f86f642d81a688f629bd3243663e32 /wiretap/file_access.c
parent29acae89d9363513efedec5d5417ab2470105100 (diff)
On I/O errors when opening a file, use wtap_close() to clean up, to make
sure we clean up everything. svn path=/trunk/; revision=46773
Diffstat (limited to 'wiretap/file_access.c')
-rw-r--r--wiretap/file_access.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/wiretap/file_access.c b/wiretap/file_access.c
index 4706035e77..c63f538c2f 100644
--- a/wiretap/file_access.c
+++ b/wiretap/file_access.c
@@ -365,10 +365,7 @@ wtap* wtap_open_offline(const char *filename, int *err, char **err_info,
Initialize the data offset while we're at it. */
if (file_seek(wth->fh, 0, SEEK_SET, err) == -1) {
/* I/O error - give up */
- if (wth->random_fh != NULL)
- file_close(wth->random_fh);
- file_close(wth->fh);
- g_free(wth);
+ wtap_close(wth);
return NULL;
}
@@ -376,10 +373,7 @@ wtap* wtap_open_offline(const char *filename, int *err, char **err_info,
case -1:
/* I/O error - give up */
- if (wth->random_fh != NULL)
- file_close(wth->random_fh);
- file_close(wth->fh);
- g_free(wth);
+ wtap_close(wth);
return NULL;
case 0: