aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/wtap.c
diff options
context:
space:
mode:
Diffstat (limited to 'wiretap/wtap.c')
-rw-r--r--wiretap/wtap.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/wiretap/wtap.c b/wiretap/wtap.c
index 5ec3286d4f..e18d797a2e 100644
--- a/wiretap/wtap.c
+++ b/wiretap/wtap.c
@@ -1542,6 +1542,13 @@ wtap_read(wtap *wth, wtap_rec *rec, Buffer *buf, int *err,
*/
if (*err == 0)
*err = file_error(wth->fh, err_info);
+ if (rec->block != NULL) {
+ /*
+ * Unreference any block created for this record.
+ */
+ wtap_block_unref(rec->block);
+ rec->block = NULL;
+ }
return FALSE; /* failure */
}
@@ -1697,8 +1704,16 @@ wtap_seek_read(wtap *wth, gint64 seek_off, wtap_rec *rec, Buffer *buf,
*err = 0;
*err_info = NULL;
- if (!wth->subtype_seek_read(wth, seek_off, rec, buf, err, err_info))
+ if (!wth->subtype_seek_read(wth, seek_off, rec, buf, err, err_info)) {
+ if (rec->block != NULL) {
+ /*
+ * Unreference any block created for this record.
+ */
+ wtap_block_unref(rec->block);
+ rec->block = NULL;
+ }
return FALSE;
+ }
/*
* Is this a packet record?