aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/file_access.c
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2013-03-25 22:04:15 +0000
committerEvan Huus <eapache@gmail.com>2013-03-25 22:04:15 +0000
commit202680971de2da8c7939e3eb490c4a8be2455d6b (patch)
treebe91902bf2e94fbe2d6b2e22846c6f8bf9fa177b /wiretap/file_access.c
parent93be2ad48ae63557378292f82854d93fb14b4305 (diff)
Wiretap file open routines should not free wth->priv on error, since that
leads to a double-free in wtap_close. Fix all the instances I found via manual code review, and add a brief comment to the list of open routines in file_access.c Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8518 svn path=/trunk/; revision=48552
Diffstat (limited to 'wiretap/file_access.c')
-rw-r--r--wiretap/file_access.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/wiretap/file_access.c b/wiretap/file_access.c
index 8b9094498b..44528c1a6a 100644
--- a/wiretap/file_access.c
+++ b/wiretap/file_access.c
@@ -98,6 +98,14 @@
* If the routine handles this type of file, it should set the "file_type"
* field in the "struct wtap" to the type of the file.
*
+ * Note that the routine does not have to free the private data pointer on
+ * error. The caller takes care of that by calling wtap_close on error.
+ * (See https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8518)
+ *
+ * However, the caller does have to free the private data pointer when
+ * returning 0, since the next file type will be called and will likely
+ * just overwrite the pointer.
+ *
* Put the trace files that are merely saved telnet-sessions last, since it's
* possible that you could have captured someone a router telnet-session
* using another tool. So, a libpcap trace of an toshiba "snoop" session