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
This commit is contained in:
Guy Harris 2012-12-26 11:59:47 +00:00
parent 29acae89d9
commit 1825519526
1 changed files with 2 additions and 8 deletions

View File

@ -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: